Subtracting birth year from the current year almost works — until it doesn't. Here's the actual logic behind exact-age math, leap years included.
The instinctive way to find someone's age — current year minus birth year — works about 364 days out of every 365. It breaks on exactly one day: before their birthday has occurred this year. Someone born in October isn't "this year minus birth year" years old in March; they're one year younger than that, because their birthday hasn't happened yet. An accurate age calculation has to compare full dates, not just years.
To find an exact age between two dates, you need to determine complete years, months, and days — not just one of those. The general approach:
Subtract the birth year from the target year as a starting point.
Compare month and day. If the target date falls before the birth month/day in the current year, subtract one from the year count — that birthday hasn't happened yet.
Once the year count is correct, work out the leftover months and days between the two dates — this is where month-length differences (28 vs. 30 vs. 31 days) come into play.
February has 28 days in most years, but 29 in leap years — years divisible by 4, except century years not divisible by 400 (so 2000 was a leap year, but 1900 wasn't). This affects two things: how many total days have passed between two dates, and what happens to people born on February 29 in years when that date doesn't exist. By convention, "leap day babies" usually have their birthday observed on either February 28 or March 1 in non-leap years, though there's no single universal rule — it often comes down to personal or local preference, and sometimes to what a specific legal or contractual document specifies.
Beyond years-months-days, two other figures are commonly useful: total days lived and total months lived. These show up in contexts like infant development milestones (often tracked in weeks or days for the first year), legal or contractual age thresholds defined in days rather than years, and simply the fun of knowing exactly how many days old someone is on a round-number milestone like day 10,000.
Our age calculator handles all of this automatically — leap years, variable month lengths, and the "hasn't had their birthday yet" edge case — and can calculate age as of any date, not just today.
That formula only works if today's date has already passed your birthday this year. If it hasn't, you need to subtract one more year, since you haven't had that birthday yet.
In non-leap years, people born on February 29 typically have their birthday observed on either February 28 or March 1, depending on local convention or personal preference, since the date doesn't exist that year.
Total days lived is useful for milestone celebrations, some medical and developmental contexts for infants, and certain legal or eligibility calculations that specify an exact day count rather than a year count.