How the Age Calculator Works

Back to the tool

Date arithmetic is trickier than subtraction

Subtracting two dates in milliseconds gives you the total elapsed time, but it doesn't tell you "31 years, 4 months, and 12 days" in a way that matches how humans think about age. Months have different lengths. Leap years add an extra day every four years (with exceptions). The Gregorian calendar isn't uniform.

This calculator does the arithmetic correctly. It returns your age in years, months, and days โ€” the same breakdown a doctor, a passport authority, or a birthday card would use.

How years are counted

The year count is straightforward: the calculator takes the difference in calendar years between the birth date and today, then adjusts by one if today is before the birthday in the current year.

Example: born 20 June 1990, today is 15 June 2026. The raw year difference is 36, but the birthday hasn't happened yet this year, so the age is 35 years. On 20 June 2026 it becomes 36.

How months and days are calculated

After the year count is settled, the remaining months are counted from the birth month to the equivalent month in the current year. Then the remaining days are the difference between the birth day-of-month and today's day-of-month, adjusted for the length of the previous month when today's day is earlier than the birth day.

This is what makes date arithmetic subtle. If you were born on the 31st and the current month only has 28 days, the calculator treats the 28th (or 29th in a leap year) as the monthly anniversary, not the 31st. This follows the convention used by most legal systems for computing ages for things like retirement benefits and driving licence eligibility.

Leap years

February 29 birthdays โ€” the roughly one-in-1,461 people born on a leap day โ€” are a common edge case. In non-leap years, the convention is that the birthday is treated as March 1 for legal purposes in most jurisdictions, or February 28 in others. This tool uses February 28 as the non-leap-year birthday for people born on February 29.

Leap years occur every four years, except for century years not divisible by 400. 1900 was not a leap year; 2000 was. The calculator handles this correctly using the standard Gregorian leap-year rule.

Timezones and "today"

The calculator uses your local date as "today" โ€” the date your browser reports based on your device's clock and timezone. If you're on one side of midnight, "today" differs from what someone in a different timezone would see. This is the correct behaviour for an age calculator: your birthday is typically celebrated on the local date, not UTC.

What else the tool shows

Beyond years, months, and days, the tool also shows:

Who uses an age calculator

The obvious use is checking someone's exact age in years, months, and days โ€” a medical form, a passport application, an anniversary. Developers also use it to verify date arithmetic in their own code. HR teams use it for retirement and benefit eligibility calculations. Teachers use it when checking student ages for year-group assignments.