DEV Community

All Done Tools
All Done Tools

Posted on Originally published at all-done.xyz

How to Calculate Your Exact Age in Years, Months and Days

Maker disclosure: I am the maker of all-done.xyz, a collection of free online tools that you can use with no signup. This is a cross-post adapted from the full guide on the all-done.xyz blog, so you can read the method here and use the free tool there.

Asking someone their age sounds simple, but giving an exact answer — in years, months, and days — trips up a surprising number of people. A quick year subtraction is fine for a casual chat, yet it can be wrong for almost half the year, and that matters on school forms, job applications, insurance paperwork, and visa or retirement checks.

Why just subtracting the years does not work

Take a person born in 1998. In 2026, 2026 minus 1998 is 28. That is only right after their birthday in 2026. Before that birthday, they are still 27. The year number alone hides whether the birthday has passed, and it says nothing about the extra months and days since the last birthday.

An exact age answers three questions at once: how many whole years have passed, how many whole months have passed since the last birthday, and how many days are left after that. To get all three reliably, work column by column, from days to years, and borrow when a column goes negative.

The borrow method, step by step

Write the two dates as day, month, and year, with the later date on top:

  1. Days first. Subtract the birth day from the current day. If the answer is negative, borrow the days in the month just before the current month: add that month's real length (28, 29, 30, or 31 days) to the current day, and take 1 away from the current month.
  2. Months next. Subtract the birth month from the current month (after any borrow in step 1). If the answer is negative, borrow 12 months: add 12 to the current month and take 1 away from the current year.
  3. Years last. Subtract the birth year from the current year (after any borrow in step 2). That result is the number of whole years.

A worked example with both kinds of borrowing

Suppose someone was born on 18 November 1995, and today is 5 April 2026.

  • Days: 5 minus 18 is negative, so borrow March's 31 days. That gives 36 minus 18 = 18 days, and April becomes March for the next step.
  • Months: March (3) minus November (11) is negative, so borrow 12 months. That gives 15 minus 11 = 4 months, and 2026 becomes 2025 for the next step.
  • Years: 2025 minus 1995 = 30 years.

Exact age: 30 years, 4 months, and 18 days. You can check it the other way: 30 years after 18 November 1995 is 18 November 2025, plus 4 months is 18 March 2026, plus 18 days is 5 April 2026.

The same steps work for age on any date, not just today. Put the target date on top — a past date for "how old was I then?" or a future date for "how old will I be?" — and follow the same borrowing rules.

Leap years and 29 February birthdays

Leap years are where a flat, average month length breaks down. Do not borrow a generic 30 days, and do not divide a total day count by 365 or 365.25 and call the result a calendar age. Calendar age is built from real calendar months.

The key rule is simple: when you borrow days, use the actual length of the previous month. Borrowing across March means looking back at February, so you add 28 days in a common year and 29 days in a leap year. A year is usually a leap year if it is divisible by 4, with the century exception that years divisible by 100 are not leap years unless they are also divisible by 400 — so 2024 was a leap year, 2100 will not be, and 2000 was.

If you were born on 29 February, you still turn a year older every year, even though your exact birth date only appears on the calendar every four years. In non-leap years, most official systems treat 1 March as the birthday for age and eligibility, although a few use 28 February. If an exact cutoff matters, check the rule used by the school, employer, or agency involved rather than guessing.

Common mistakes to watch out for

  • Ignoring whether this year's birthday has passed. This alone makes a year-only subtraction wrong for about half the year.
  • Borrowing a flat 30 days. Months are not all 30 days long, so this quietly shifts the day count.
  • Forgetting leap years. Any range that crosses February can be off by a day if February's real length is ignored.
  • Mixing up day and month order. A date written as 03/04 can mean 3 April or March 4 depending on the country, so confirm the format before you calculate.
  • Averaging months or years. Dividing by 30.44 days per month or 365 days per year gives an approximation, not an exact calendar age.

For an official form, it is worth checking your hand calculation a second way — or with a trusted calculator — especially near a cutoff such as 18 years, a school admission date, or a retirement age.

When exact age really matters

In everyday conversation, "I'm 34" is plenty. At a boundary, the months and days decide the outcome: a child born one day after a school cutoff may wait a full year, and the gap between 17 years, 11 months and 18 years, 0 months can be the gap between ineligible and eligible. The same precision matters for pension and retirement eligibility, insurance premiums, minimum-age checks, and age on a specific application date.

Try it in seconds

If you would rather skip the borrowing, use the free Age Calculator on all-done.xyz. Enter your date of birth and it gives your exact age in years, months, and days — no signup needed. It is a handy way to double-check the manual method above.

For the longer version of this guide, see the original post on the all-done.xyz blog: How to Calculate Your Exact Age in Years, Months and Days.

Top comments (0)