Skip to content
EveryFix

How to calculate age and the days between two dates

Guide⏱ 8 min readUpdated 2026-10-18

Short answer

To get an exact age, subtract the birth date from the end date one part at a time (year, month, day). If the day difference is negative, borrow the length of the month before the end date's month; if the month difference is negative, borrow 12 months from the years. To count days between dates, take the later date minus the earlier one, which already includes leap days. Born on December 25, 1985, someone is 40 years, 9 months, 23 days old on October 18, 2026, and has lived 14,907 days. Counting both end dates adds 1.

Open the free Age Calculator to get an exact age

Exact age by calendar borrowing, and days between dates

Y = y2 - y1; M = m2 - m1; D = d2 - d1; if D < 0: M = M - 1 and D = D + (days in the month before the end month); if M < 0: Y = Y - 1 and M = M + 12. Days between = later date - earlier date

  • •y1, m1, d1 are the year, month number, and day of the earlier date (the birth date)
  • •y2, m2, d2 are the year, month number, and day of the later date
  • •Y, M, D are the resulting years, months, and days
  • •days between counts elapsed days, so the start date is day zero; add 1 for an inclusive count
  • •a year is a leap year if divisible by 4, except years divisible by 100 that are not divisible by 400

Two questions that sound like one

People ask for an age in two different forms. One is the calendar form: 40 years, 9 months, 23 days. The other is a plain count: 14,907 days. They describe the same stretch of time, but they are computed differently and fail in different ways.

The day count is simple and unambiguous. It is just how many midnights separate two dates. The years-months-days form depends on a convention, because months are not the same length. A month is 28, 29, 30, or 31 days, so there is no single right answer to "how many days is one month?" This guide covers both, and explains where the convention matters and where it does not.

Calendar borrowing, step by step

The method is the same as subtracting numbers on paper with borrowing. Write the end date and the birth date as year, month, day. Subtract each part. If the day result is negative, take one month off the month result and add the number of days in the month before the end date's month. If the month result is negative, take one year off the year result and add 12 months.

Worked example: born December 25, 1985, measured on October 18, 2026.

Years: 2026 - 1985 = 41. Months: 10 - 12 = -2. Days: 18 - 25 = -7.

Days are negative, so borrow a month: months become -3, and the day result gains the length of September (the month before October), which is 30. That gives -7 + 30 = 23 days. Months are now negative, so borrow a year: years become 40, and months become -3 + 12 = 9. The answer is 40 years, 9 months, 23 days.

You can check any answer by adding it back. December 25, 1985 plus 40 years is December 25, 2025. Plus 9 months is September 25, 2026. Plus 23 days is October 18, 2026, because five days finish September and 18 more land on the 18th. It lands exactly on the end date.

Two more examples with their results. Born March 15, 2000, on October 18, 2026: no borrowing is needed, so the age is 26 years, 7 months, 3 days. Born August 31, 2015, on October 18, 2026: the day difference is 18 - 31 = -13, so borrow September's 30 days to get 17 days, and the month difference becomes 10 - 8 - 1 = 1. The age is 11 years, 1 month, 17 days.

Leap years and total days

Leap years are why you cannot get total days by multiplying age by 365. The Gregorian rule, as the U.S. Naval Observatory states it, is that every year divisible by 4 is a leap year, except years divisible by 100, which are not leap years unless they are also divisible by 400. So 1900 and 2100 are not leap years, while 2000 and 2024 are. Over any 400-year cycle there are 97 leap years, which gives 400 x 365 + 97 = 146,097 days and an average year of 365.2425 days.

Here is a real count. From January 1, 2000 to October 18, 2026, there are 26 full years, 2000 through 2025. Seven of them contained a leap day (2000, 2004, 2008, 2012, 2016, 2020, 2024), so those years total 26 x 365 + 7 = 9,497 days. From January 1 to October 18, 2026 adds another 290 days (273 days through September 30, then 17 more days, since 2026 is not a leap year). The total is 9,787 days. Multiplying 26.8 years by 365 would give 9,782 and miss five days, while dividing 9,787 by 365.2425 gives 26.80 years, which matches the 26 years, 9 months, 17 days you get from the calendar method.

People born on February 29 are the special case. Born February 29, 2000, the calendar age on February 28, 2025 is 24 years, 11 months, 30 days, with 9,131 days lived. On March 1, 2025 it becomes 25 years, 0 months, 0 days, with 9,132 days lived. That is the convention the Age Calculator follows: in a common year the birthday is treated as arriving on March 1. Some forms and legal systems use February 28 instead, so check the rule that applies to your situation when the exact date matters.

Inclusive versus exclusive counting

The most common error in date arithmetic is the fence-post error: counting both ends when you should count the gaps. Subtracting dates gives the number of days that have elapsed, which treats the start date as day zero. From October 18 to December 25, 2026 is 68 days that way. If you count both October 18 and December 25 as full days, the answer is 69.

Neither is wrong, but they answer different questions. Elapsed days is the right answer for age, for a countdown, and for "how many days since." Inclusive counting is right when both boundary days count as a full day of something, such as a contract that runs from the 1st through the 31st, a class that meets on both the first and last dates, or a hotel pricing by days rather than nights. A 5-night hotel stay from the 10th to the 15th is 5 elapsed days but touches 6 calendar days.

A year makes a clean example. January 1, 2026 to December 31, 2026 is 364 days elapsed, but it is 365 days inclusive, which is one full year. January 1, 2026 to January 1, 2027 is 365 days. The Date Difference Calculator counts elapsed days, so entering the same date twice returns 0. If your situation counts both end dates, add 1 to the result.

Month-length pitfalls

Treating every month as 30 days is the classic shortcut, and it drifts: 12 x 30 = 360, five days short of a common year. The error is largest for long spans and near month ends.

Month ends are where conventions collide. From January 31 to March 1 is 29 days in 2023 and 30 days in 2024, because February has 28 days in one year and 29 in the other. And "add one month to January 31" has no single answer. JavaScript's date object rolls the extra days into March, giving March 3 in 2023 and March 2 in 2024. Python's dateutil library clamps to the last day of February instead, giving February 28, 2023 and February 29, 2024. Two correct programs can therefore disagree about a months-and-days breakdown for dates that start on the 29th, 30th, or 31st.

The practical rule is to trust the total-days number for month-end dates, and treat the months-and-days form as a convention. If a decision depends on it, such as an eligibility cutoff or a legal deadline, verify with the add-back check described above, and ask which convention the rule-maker uses.

Time of day and daylight saving time add a second source of error. On a clock-change day a local day lasts 23 or 25 hours, so a calculation that divides a millisecond difference by 86,400,000 and then rounds down can be off by one day. Counting calendar dates, rather than elapsed hours, avoids this.

Which tool for which question

The Age Calculator takes a birth date and, optionally, an "as of" date, and returns the age in years, months, and days, the total days lived, and the days until the next birthday. Use the as-of field to answer "how old will she be at graduation" or "how old was he when it happened."

The Date Difference Calculator takes any two dates in either order and shows total days, weeks and leftover days, and the years-months-days breakdown. For example, October 18, 2026 to December 25, 2026 is 68 days, which is 9 weeks and 5 days.

The Event Countdown Calculator is different because it works from the current moment and an event time, so it can report hours and minutes as well as whole days. The Time Duration Calculator handles clock times within a day, such as the hours between a start and end of a shift, including overnight shifts and unpaid breaks. Use the date tools for whole days and the time tools for hours and minutes, and do not mix them.

Quick sanity checks

A few checks catch most mistakes. Convert years to days at 365.25, not 365: someone aged 40 has lived about 14,610 days. Confirm that months are between 0 and 11 and that days are less than the length of a month. Add the result back to the start date and confirm you land on the end date. And decide before you start whether the question wants elapsed days or an inclusive count.

Please note: This calculator provides estimates for general informational purposes only. Results may not be accurate for every situation — use your judgment and consult a relevant professional when it matters.

Frequently Asked Questions

How many days old am I?+

Count the days between your birth date and today, with your birth date as day zero. For example, someone born December 25, 1985 has lived 14,907 days as of October 18, 2026. The Age Calculator shows this as total days lived and includes every leap day automatically.

Is 2100 a leap year?+

No. A year divisible by 100 is not a leap year unless it is also divisible by 400. That is why 1900 and 2100 are common years and 2000 was a leap year.

Should I count the start and end dates when finding days between dates?+

It depends on the question. Elapsed days, which is what a date subtraction gives, treats the start date as day zero, so October 18 to October 20 is 2 days. If both dates count as full days, add 1 and get 3. Age, countdowns, and days since an event use elapsed days.

Why do two calculators give different months and days for the same dates?+

Because the months-and-days breakdown depends on a convention for borrowing days from a month, and month lengths vary. The difference usually shows up when the start date falls on the 29th, 30th, or 31st. The total number of days will agree between correct calculators, so use that when you need a number you can rely on.

How old is someone born on February 29?+

Using calendar borrowing, a person born on February 29, 2000 is 24 years, 11 months, 30 days old on February 28, 2025, and turns 25 on March 1, 2025. Some legal and administrative systems use February 28 as the birthday in common years, so check the rule that applies to you.

How many days until my birthday?+

Subtract today's date from the next occurrence of your birthday. For a December 25 birthday, the count from October 18, 2026 is 68 days. The Age Calculator reports this as days until next birthday, and you can change the as-of date to plan ahead.

Skip the math

Enter your numbers and the Age Calculator does the work for you — free, and it runs entirely in your browser.

Open the free Age Calculator to get an exact age