Calculate an exact age, the way you would by hand
An age calculator turns two dates — a date of birth and a target date — into a precise span of time. The headline result is the calendar age in years, months and days, but a span of time can also be expressed entirely in months, weeks, days or hours, which is handy for tracking a baby’s growth, planning milestones, or settling the perennial “how many days old am I?” question.
How the maths works
Naively subtracting one date from another and dividing by 365 is wrong, because months and years have different lengths. Instead this tool anchors by months. First it counts the whole number of calendar months between the two dates:
totalMonths = (atYear − birthYear) × 12 + (atMonth − birthMonth)
It then advances the date of birth forward by totalMonths whole months to form an
anchor date, clamping the day to the last day of the month where needed (so 31 January
plus one month lands on 28 or 29 February, not an impossible 31 February). If that anchor
overshoots the target, it drops one month and re-anchors. The leftover days are simply
the whole days between the anchor and the target date, and the years and months come from splitting
totalMonths back out: years = floor(totalMonths ÷ 12) and
months = totalMonths − years × 12. Because every step uses the real length of each
calendar month, leap years and 28-, 30- and 31-day months are handled automatically — and the day
count can never come out negative, which a single-borrow subtraction can.
A worked example
Take a birth date of 15 March 1990 and a target date of
10 June 2024. The whole months between them are
(2024 − 1990) × 12 + (6 − 3) = 411. Advancing 15 March 1990 by 411 months lands on
15 June 2024 — but that is after 10 June 2024, so we drop one month to 410 and re-anchor
on 15 May 2024. The leftover days from 15 May to 10 June are 26 (16 days left in May plus 10 in
June). Splitting 410 months back out gives floor(410 ÷ 12) = 34 years with
410 − 408 = 2 months. The exact age is therefore
34 years, 2 months and 26 days. Expressed differently, that is
410 total months, 1,786 weeks, or 12,506 days of life.
The totals at a glance
| Unit | How it is derived | Good for |
|---|---|---|
| Years / months / days | Borrow-subtraction shown above | The conventional “how old” answer |
| Total months | years × 12 + months | Infant & toddler milestones |
| Total weeks | floor(total days ÷ 7) | Pregnancy and newborn tracking |
| Total days | Whole days between the two dates | Day-count milestones (e.g. 10,000 days) |
| Total hours | total days × 24 | Fun facts and curiosity |