How to Calculate Age Exactly in Years, Months and Days
The borrowing method for exact age, how leap years and 29 February birthdays behave, and the month-end cases where two answers are both defensible.
Age in whole years is easy. Age in years, months and days is where it gets interesting, because months are not a fixed length and the subtraction has to borrow from a unit whose size changes.
It comes up more often than it sounds: school and sports eligibility cut-offs, visa and pension age rules, paediatric dosing bands, and any form that asks for an age "as at" a date that is not today. All of them need the exact figure rather than a rounded one.
The borrowing method
Write both dates as year, month, day and subtract each column. Then fix up any negative result, right to left — exactly like subtracting 47 from 123 by hand.
days = today.day − birth.day- If
daysis negative, subtract 1 from the month difference and add **the
number of days in the month before today's month**.
months = today.month − birth.month(after any adjustment above)- If
monthsis negative, subtract 1 from the year difference and add 12. years = today.year − birth.year(after any adjustment above)
The order matters. Always resolve days before months, and months before years.
Example 1: no borrowing needed
Born 15 July 1990, measured on 27 October 2026.
- days: 27 − 15 = 12
- months: 10 − 7 = 3
- years: 2026 − 1990 = 36
Age: 36 years, 3 months, 12 days. Because every column was already positive, no adjustment was required.
The same interval expressed in smaller units: 13,253 days, which is 1,893 whole weeks plus 2 days, or 318,072 hours. Note that 36 years is not 36 × 365 = 13,140 days — the extra 113 days are 9 leap days plus the 3 months and 12 days.
Example 2: borrowing twice
Born 30 November 1998, measured on 28 February 2026.
- days: 28 − 30 = −2. Borrow. The month before February 2026 is January,
which has 31 days: −2 + 31 = 29, and carry 1 out of the months.
- months: 2 − 11 = −9, minus the 1 borrowed = −10. Borrow again: −10 + 12 =
2, and carry 1 out of the years.
- years: 2026 − 1998 = 28, minus the 1 borrowed = 27.
Age: 27 years, 2 months, 29 days. The 29-day fragment looks wrong at a glance and is correct: from 30 November to 28 December is one month, to 28 January is two, and 28 January to 28 February is a further 31 days — of which 29 remain after the two whole months are counted out.
Which month do you borrow from?
This is the one genuine ambiguity in the whole calculation. Some implementations borrow the length of the month preceding the end date (used above), others the length of the birth month. The two agree most of the time and differ by a day or two around February. Neither is wrong; they answer slightly different questions. If you compare two tools and see a one-day discrepancy in a day count, this is almost always why — the years and months will match.
Leap years
The rule, in full: a year is a leap year if it is divisible by 4, except centuries, unless the century is divisible by 400.
- 2024 → divisible by 4, not a century → leap
- 2026 → not divisible by 4 → not leap
- 1900 → century, not divisible by 400 → not leap
- 2000 → century, divisible by 400 → leap
February 2026 therefore has 28 days, which is what example 2 would have needed had the borrow fallen there.
29 February birthdays
Someone born on 29 February 2004 has a real birthday only in leap years, so in other years the "age increases" moment has to be assigned by convention. Using the borrowing method:
| Measured on | Result |
|---|---|
| 28 February 2026 | 21 years, 11 months, 30 days |
| 1 March 2026 | 22 years, 0 months, 0 days |
| 29 February 2028 | 24 years, 0 months, 0 days |
So the arithmetic treats 1 March as the day the year ticks over in non-leap years. Many jurisdictions follow the same convention for legal ages; some use 28 February instead. The 30-day fragment on 28 February is not a bug — February 2026 has 28 days and the borrow comes from January's 31.
Month-end edge cases
The "same day next month" problem has no clean answer when the day does not exist. Two examples that look alike and are not:
- Born 31 January 2000, measured 30 March 2026 → **26 years, 1 month,
27 days**. The February boundary is skipped over entirely.
- Born 31 March 2000, measured 30 March 2026 → **25 years, 11 months,
27 days** — one day short of 26, as you would expect.
The practical rule: a result like "1 month, 27 days" or "11 months, 27 days" is usually a month-end artefact rather than an error. Verify it by stepping forward from the birth date month by month and counting what is left over.
Common mistakes
- Dividing days by 365.25. Fine for an approximate average age, wrong for an
exact one, and it drifts by days over a long interval.
- Subtracting the years and then checking the birthday separately. It works
for whole years and falls apart the moment you want months and days.
- Ignoring time zones. A birth late at night in one zone is the previous day
in another, which can shift an exact age by a full day.
- Mixing conventions mid-calculation, which is how you end up with a
negative day count.
Check any of these with the age calculator, or use the date duration calculator when you want the plain number of days between two dates rather than a years-months-days breakdown.
Calculators used in this guide
More guides
- How EMI Is Calculated (And What Prepayment Actually Saves)The EMI formula worked through on a 25 lakh loan, why early instalments are mostly interest, and what tenure and prepayment really change.
- How to Calculate GST: Adding It, Removing It, and Splitting ItAdd GST to a base price, strip it out of an inclusive one, split a rate into CGST and SGST, and see why input tax credit changes the maths.
- Linux Is Out of Disk Space: A Systematic Way to Find Out WhyWhy df and du disagree, how deleted-but-open files consume space invisibly, and the order to check things in.
