Years Between Dates Calculator

Find the exact span between two dates in years, months, and days, plus decimal years, total months, weeks, and days.

Time & Date Age mode Leap year aware
Rate this calculator · 4.3 (3)

Years between two dates

Years, months, days breakdown · age calculator mode · inclusive option

Instructions — Years Between Dates Calculator

1

Pick a mode

Use Between two dates for any pair of dates: anniversaries, employment spans, contract durations, project timelines. Switch to Age (birthday) and the labels flip to date of birth and as-of date, with a next-birthday cell added to the result.

2

Enter both dates

The defaults are today and 25 years ago, which gives an instant working result on first load. Reverse order is fine; the calculator swaps internally and labels the formula display so you can see what happened. Span quick-picks set the start date relative to whatever end date you have entered.

3

Pick inclusive or not

Default is exclusive: April 1 to April 1 next year reads as 1 year, 0 months, 0 days. Switch to inclusive and the same span reads as 1 year, 0 months, 1 day, because the end date itself is counted. Legal deadlines usually want exclusive; some lease and tax computations want inclusive.

February 29 birthdays: the calculator treats a leap-day birthday as completing the year on February 28 of non-leap years, which matches the common US insurance practice.
Decimal years: the result shows years to three decimals, computed by dividing total days by 365.2425 (the average Gregorian year length).

Formulas

Year-month-day differences look like simple subtraction but need careful borrowing when the end date is earlier in the year than the start, or earlier in the month. Here is what the calculator does.

Years, months, days
$$ \Delta = Y\text{y}, \; M\text{m}, \; D\text{d} $$
Subtract year-on-year, month-on-month, day-on-day. Borrow from the previous month if days go negative, then borrow from the year if months go negative.
Day borrow
$$ \text{if } D_e < D_s: \; D = D_e - D_s + d_{prev}, \; M{-}{=}1 $$
Add the number of days in the month preceding the end month. So March 5 minus January 20 borrows 28 days (February in a non-leap year).
Month borrow
$$ \text{if } M < 0: \; M = M + 12, \; Y{-}{=}1 $$
A negative month difference means the end falls earlier in its year than the start. Subtract one year and add twelve months to make the result non-negative.
Decimal years
$$ Y_d = \frac{\Delta d}{365.2425} $$
The Gregorian year averages 365.2425 days because the 400-year cycle has exactly 97 leap years (146,097 days total). Good to the nearest day over a span of a few thousand years.
Leap year test
$$ \text{leap}(y) = (y \bmod 4 = 0) \wedge (y \bmod 100 \ne 0 \vee y \bmod 400 = 0) $$
Divisible by 4 means leap, unless also divisible by 100 and not by 400. So 2000 was leap, 1900 was not, 2100 will not be.
ISO 8601 duration
$$ P\,Y\text{Y}\,M\text{M}\,D\text{D} $$
Standard format for date spans. P3Y6M14D means three years, six months, and fourteen days. Used in calendaring software and scheduling APIs.

Reference

Common years-between contexts
ContextWhat to computeNotes
Age (birthday)Years, months, days from DoBInsurance often uses age last birthday; some uses age nearest birthday
Employment tenureYears and months from hire dateBLS reports median US tenure of 3.9 years in 2024
Statute of limitationsYears from the event2, 3, 6 years are common; rules vary by state and tort type
Anniversary spansWhole years25th = silver, 50th = gold, 60th = diamond
Depreciation (US)Years of useful lifeMACRS uses 3, 5, 7, 10, 15, 20, 27.5, or 39 year classes
Pension serviceYears and months creditedOften rounded to nearest month or quarter
Visa residencyYears of physical presenceUS naturalization typically requires 5 continuous years (3 if married to citizen)

Year length reference

Common spans expressed in days and months. Day counts vary by one or two days depending on which leap years fall inside the span.

Years to days
YearsDays (approx)
1 year365 or 366
5 years1,826 or 1,827
10 years3,652 or 3,653
18 years (legal age)6,574 or 6,575
25 years9,131 or 9,132
50 years18,262 or 18,263
100 years (century)36,524 or 36,525
400 years (cycle)146,097 exact
Anniversary year names
AnniversaryTraditional name
10 yearsTin
20 yearsChina
25 yearsSilver
30 yearsPearl
40 yearsRuby
50 yearsGold
60 yearsDiamond
75 yearsPlatinum

Note: the calculator borrows month length from the month preceding the end date when day counts go negative. So January 31 to February 28 reads as exactly one month and zero days, not 28 days.

Article — Years Between Dates Calculator

Years between dates: a practical guide to counting time

A years between dates calculator gives the exact span between two calendar dates in years, months, and days, plus the same span as decimal years, total months, total weeks, and total days. The same arithmetic that tells you 1972 to 2026 is 53 years, 9 months, and a handful of days is what a birthday-style age calculator uses, and what HR systems use to credit pension service. The hard part is borrowing days from short months and accounting for the Gregorian leap year rule.

The calculator above runs entirely in your browser. Pick a mode, enter the two dates, and the result updates as you type. The default span is 25 years ending today, which gives an immediate working number on first load. Reverse the order and the calculator swaps internally and flags the swap in the formula display.

What this calculator does

The headline result is the span in years, months, and days, written as Yy Mm Dd. Beneath that you get the same span expressed five other ways: completed full years, decimal years to three decimal places, total months (years times 12 plus extra months), total weeks plus extra days, and total calendar days. These are useful in different contexts. Lawyers care about completed years for statutes of limitations. Insurance underwriters use age last birthday. HR systems often report tenure in years and months for vesting schedules.

The inclusive toggle controls whether the end date itself counts. Default is exclusive, which matches most contract language. Switch to inclusive and the span gains a day, which is what you want for room nights, residency days, or any deadline expressed as "through" rather than "until".

The math, in one line
Y = end.year - start.year then borrow if needed
M = end.month - start.month borrow 12 if negative
D = end.day - start.day borrow daysInPrevMonth if negative
decimal_years = totalDays / 365.2425

Age calculator mode

Age mode is the same arithmetic with different labels. Enter your date of birth as the start, and either today or any reference date as the end, and the headline reads as your age in years, months, and days. The result grid adds a next-birthday cell with the upcoming date and the day countdown, which is the number people actually want when they ask "how long until my birthday?"

The convention used here matches the natural calendar: you turn 35 on the morning of your 35th birthday, not at midnight the day before. That sounds obvious, but until the United Kingdom passed the Family Law Reform Act in 1969, English common law treated a person as completing the year at the start of the day before their birthday. The reform took effect on January 1 1970 and aligned legal birthdays with the popular understanding. A handful of US state rulings still reference the older rule in narrow contexts.

Did you know

Jeanne Calment of Arles, France lived 122 years and 164 days, from February 21 1875 to August 4 1997. Guinness World Records lists her as the oldest verified person in human history. Her life spanned 30 leap years and 44,724 days. As a teenager she sold canvas to Vincent van Gogh in her father's shop in 1888. No verified human has come within a year of her record in the 28 years since.

How the math works

The calculator subtracts year from year, then month from month, then day from day, and borrows when anything goes negative. The catch is what to borrow. If the end day is smaller than the start day, the calculator adds the day count of the month preceding the end month, not the start month. So January 20 to March 5 borrows 28 days (February in a non-leap year) or 29 days (in a leap year). January 31 to February 28 reads as exactly one month and zero days, because the calendar runs from end of January to end of February.

This is the same convention Microsoft Excel uses for the DATEDIF function with the "YMD" unit, and the same convention PHP DateInterval uses by default. Different conventions exist. Some legal systems define one month as exactly 30 days, which would give 29 days for the January 31 to February 28 case. The calculator follows the calendar-anchored convention because it matches what most people mean when they say "one month".

The 30 days versus one month difference

30 days from January 31 is March 2 in a non-leap year, March 1 in a leap year. One month from January 31 is February 28 or 29. A contract that says "within 30 days" is not the same as one that says "within one month". The first is fixed; the second varies by two or three days depending on which month you start in.

Leap years and the Gregorian cycle

The Gregorian calendar repeats every 400 years. A 400-year cycle contains exactly 146,097 days and 97 leap years, which gives an average year length of 365.2425 days. This is the figure the decimal years cell uses. The tropical year (Earth's actual orbital period as measured against the seasons) is 365.2422 days, so the Gregorian calendar drifts by 0.0003 days per year. At that rate it will accumulate a one-day error after about 3,236 years.

The rule for leap years is straightforward but easy to misremember. A year is a leap year if it is divisible by 4, except years divisible by 100 that are not also divisible by 400. So 2000 was a leap year because 400 divides it. 1900 was not, because 100 divides it but 400 does not. 2100 will not be either. The next century year that is also a leap year is 2400.

  • 1 cycle = 400 years = 146,097 days exactly
  • Leap years per cycle = 97
  • Average year = 365.2425 days
  • Tropical year = 365.2422 days (difference: 0.0003)
  • Julian year = 365.25 days (no 100/400 rule, error of 1 day per 128 years)
  • Common year = 365 days (303 of every 400)
  • Leap year = 366 days (97 of every 400)

Employment tenure and pensions

HR and pension calculations are where the years-and-months breakdown earns its keep. The US Bureau of Labor Statistics reports median tenure of 3.9 years for wage and salary workers in January 2024, with public-sector workers at 6.2 years and private-sector workers at 3.5 years. Older workers stay much longer: workers aged 55 to 64 had median tenure of 9.6 years, more than three times the 2.7 years for workers aged 25 to 34.

Vesting schedules typically reward longer tenure with steeper benefit accrual. A common 401(k) graded vesting schedule grants 20% per year of service starting in year two, reaching 100% at year six. A defined-benefit pension formula often multiplies years of credited service by a percentage (commonly 1.5% to 2%) and by final average salary. The calculator's whole-month output handles partial years cleanly, because most plans credit service in monthly or quarterly increments.

Tip

When calculating tenure for severance, check whether the plan counts the start day, the termination day, or both. The inclusive toggle on this calculator lets you produce either reading. A March 15 2019 to March 15 2026 tenure reads as exactly 7 years exclusive, or 7 years and 1 day inclusive. Some severance formulas round up at six months; others use exact months. Read the plan document.

Pregnancy and Naegele's rule

Naegele's rule, named after the 19th-century German obstetrician Franz Karl Naegele, estimates a due date by adding 280 days (40 weeks) to the first day of the last menstrual period. It assumes a 28-day cycle and ovulation on day 14, which is a useful average but not universal. Modern obstetric practice still uses Naegele's rule as a starting point, then refines with ultrasound dating in the first trimester when available.

The years-between calculator handles the same arithmetic in either direction. From a last menstrual period of April 1 2025, the due date estimate is around January 8 2026, which the calculator reads as 9 months and 7 days forward. From a known due date, work backward and the calculator finds the conception window. Actual pregnancies vary; the median is 40 weeks from LMP but the normal range stretches from 37 to 42 weeks, and most spontaneous deliveries happen within the week before or after the estimated date.

Median pregnancy
40 weeks
280 days from LMP (Naegele)
Full-term range
37 to 42 weeks
259 to 294 days

Historical spans

Historical date calculations look identical to modern ones in the calculator, but real-world precision needs care when spanning the Gregorian calendar reform. Pope Gregory XIII introduced the modern calendar in October 1582, deleting ten days from the Julian calendar to correct accumulated drift. The day after Thursday October 4 1582 was Friday October 15 in countries that adopted immediately: Spain, Portugal, the Papal States, much of Italy. Britain and its colonies held out until 1752 and dropped eleven days. Russia switched in 1918, Greece in 1923.

For most everyday purposes, this matters only when you are computing spans across the reform date in a country that used the Julian calendar at the time. The number of days between July 4 1776 and July 4 2026 is well defined in the Gregorian calendar (the calculator handles it), but if you wanted the same span across an English Julian date in 1700, you would need to convert first. ISO 8601 and modern computing date types assume Gregorian throughout, including a hypothetical "proleptic Gregorian" backward extension.

Common pitfalls

The 365 trap. Multiplying years by 365 underestimates the day count by about one day per four years. Over a 25-year span the error is six days; over 100 years it is 24 days. Use the calculator for any span where day-level precision matters.

Same-day-of-year is not always a full year. February 29 2024 to February 28 2025 is 365 days, but the calculator reads it as 11 months and 30 days, not one year, because February 28 is the end of February in 2025, not the same day-of-month as the start. February 29 2024 to March 1 2025 is one year and zero days. The interpretation depends on whether you anchor to day-of-month or day-of-year.

Inclusive versus exclusive. The default reading in US case law and most contract language is exclusive: the start date is day zero. The Schengen 90/180 rule for travel counts inclusively: every day of physical presence in the area counts, including arrival and departure days. Tax and statute language varies. Read the rule before counting.

Time zones do not affect date-only math. The calculator works in your browser's local time, but the inputs are pure dates with no time component. Two people in different time zones who enter the same dates get the same answer. The complication only arises when you mix dates and timestamps, which this tool does not.

Different tools, different answers

Excel DATEDIF, PHP DateInterval, JavaScript date math, and Python's dateutil can give slightly different results for edge cases like January 31 to February 28. Most use the calendar-anchored borrow (this calculator does too), but some lean on a fixed-30-day month convention. If a number from another tool disagrees with this one by one or two days, check the convention before treating either as wrong.

FAQ

Subtract the start year from the end year, then adjust for months and days. If the end month is before the start month (or the day is smaller), borrow from years or months. For example, July 15 2018 to March 3 2024 is 5 years, 7 months, and 17 days. The calculator above does this automatically and shows the breakdown plus total months, weeks, and days.
Age in years is the number of complete years from your birthday to today. Born June 1 1990, on May 20 2025 you are still 34, but on June 1 2025 you turn 35. The calculator handles this by checking whether your birthday has already occurred this year. Switch to Age mode for a next-birthday cell that counts down the days.
Most US insurance and legal practice treats a February 29 birthday as completing the year on February 28 of non-leap years, then on February 29 in leap years. Some UK practice rolls to March 1. The calculator follows the date-arithmetic convention, which gives consistent results across leap and non-leap years.
About 2 years, 8 months, and 26 days, depending on which months and which leap year fall inside the span. The exact breakdown changes day to day because month lengths and leap year placement matter. Enter your two dates above for the precise count.
No. A leap year has 366 days, occurring roughly every four years. The Gregorian rule skips three of those leap days per 400 years (1700, 1800, 1900, but not 2000). The long-run average is 365.2425 days per year, which matches the tropical year to within 26 seconds.
Subtract your hire date from today (or your termination date). For example, started March 15 2019, today May 13 2026: that is 7 years, 1 month, and 28 days. Switch the calculator off Age mode and you get the same breakdown plus total months for any HR or pension calculation.
A calendar year is January 1 to December 31. An exact year is any 365 or 366 day span anchored to a specific date. June 15 2023 to June 15 2024 is exactly one year (366 days, because it includes February 29 2024). The calendar year 2024 is also 366 days, but starts on January 1.
Naegele's rule adds 280 days (40 weeks) to the first day of the last menstrual period to estimate a baby's due date. The years-between formula is the same arithmetic in reverse: from LMP April 1 2025, the calculator returns approximately 9 months, 7 days to January 8 2026. Real pregnancies vary; the median is 40 weeks but the range is wide.