To calculate the exact age difference between two people, compare their complete dates of birth rather than only their birth years. Put the earlier birth date first, because it belongs to the older person, then calculate the calendar difference from that date to the later birth date in years, months, and days.
For example, two people born in 1990 and 1995 are not automatically exactly five years apart. Their birth months and days determine the precise age gap.
Quick formula: Age Difference = Later Birth Date − Earlier Birth Date
The result is normally expressed as X years, Y months, and Z days. Want to skip the manual math? You can verify any result with our Age Difference Calculator.
Age Difference Formula
The basic age difference formula is:
Age Difference = Later Birth Date − Earlier Birth Date
Here, the earlier birth date belongs to the older person and the later birth date belongs to the younger person. You are measuring the calendar interval between those two dates.
If you only subtract the birth years, you get a rough age gap. For an exact age difference, the month and day must also be included.
How to Calculate Age Difference Manually
A practical way to calculate an age difference by hand is to treat the two dates like a calendar subtraction problem: work through the days, months, and years, borrowing from the next-higher column whenever a value is too small to subtract. This uses the same calendar borrowing mechanics as calculating age from a date of birth, see our guide on how to calculate age for the full explanation.
| Step | What to Calculate | Adjustment if Needed |
|---|---|---|
| 1 | Put the birth dates in order | Earlier DOB comes first |
| 2 | Subtract the days | Borrow the actual length of the preceding month if needed |
| 3 | Subtract the months | Borrow 12 months from the year if needed |
| 4 | Subtract the years | Use the adjusted year after any borrowing |
Step 1: Put the Two Birth Dates in Order
First determine which date of birth is earlier.
- The person with the earlier DOB is older.
- The person with the later DOB is younger.
- Calculate forward from the earlier date to the later date.
Keeping the dates in this order makes the result easier to interpret and avoids accidentally producing a negative difference.
Step 2: Calculate the Difference in Days
Start with the day numbers. If the day in the later birth date is smaller than the day in the earlier birth date, borrow the actual number of days in the preceding calendar month (28, 29, 30, or 31) before subtracting.
Step 3: Calculate the Difference in Months
After resolving the days, subtract the month numbers. If the adjusted month in the later date is smaller than the month in the earlier date, borrow 12 months from the year, then subtract normally.
Step 4: Calculate the Difference in Years
Finally, subtract the earlier year from the adjusted later year.
Combine the three parts to give the final result:
X years, Y months, Z days
Keeping the components separate matters because calendar months do not all contain the same number of days.
Worked Age Difference Examples
The easiest way to understand the method is to see both a simple calculation and one that requires borrowing.
Example 1: Calculation Without Borrowing
Suppose the two dates of birth are:
- Older person: April 15, 1990
- Younger person: November 23, 1995
No borrowing is required.
| Component | Calculation | Difference |
|---|---|---|
| Days | 23 − 15 | 8 days |
| Months | 11 − 4 | 7 months |
| Years | 1995 − 1990 | 5 years |
Exact age difference: 5 years, 7 months, and 8 days.
Example 2: Calculation With Borrowing
Now consider a more difficult example:
- Older person: October 24, 1990
- Younger person: March 12, 1996
Days: 12 is smaller than 24, so borrow February 1996’s 29 days (1996 was a leap year): 12 + 29 = 41, and 41 − 24 = 17 days.
Months: borrowing reduced March to February (month 2), so borrow 12 months from the year: 2 + 12 = 14, and 14 − 10 = 4 months.
Years: 1995 − 1990 = 5 years.
Exact age difference: 5 years, 4 months, and 17 days.
Why Subtracting Birth Years Gives Only an Approximate Age Gap
Subtracting the two birth years is useful for a quick estimate, but it ignores the month and day of each birthday.
For example:
| Earlier DOB | Later DOB | Birth-Year Subtraction | Exact Calendar Difference |
|---|---|---|---|
| December 31, 1990 | January 1, 1995 | 5 years | 4 years, 1 day |
| January 1, 1990 | December 31, 1995 | 5 years | 5 years, 11 months, 30 days |
In the first example, subtracting the years overstates the gap by almost a year. In the second, it understates it by almost a year.
So this shortcut is fine for a rough answer, but not when you need the exact difference between two dates of birth.
Common Mistakes When Calculating Age Difference
- Using only the birth years: This ignores the birth months and days.
- Assuming every month has 30 days: Calendar months contain 28, 29, 30, or 31 days.
- Borrowing from the wrong month: When borrowing days, the relevant calendar month must be identified correctly.
- Forgetting leap years: February can contain 29 days instead of 28.
- Mixing calculation methods: Month-end date arithmetic can be represented differently by different software systems. Use one convention consistently.
- Reversing the birth dates: Put the earlier DOB first if you want a positive age gap and a clear older-to-younger comparison.
- Rounding too early: Do not turn several months into a fraction of a year before finishing the calendar calculation.
- Using an ambiguous date format: A date such as 03/04/1990 can mean March 4 or April 3 depending on local convention. Writing the month name or using the unambiguous YYYY-MM-DD format avoids confusion.
Special Cases When Comparing Two Birth Dates
Most DOB comparisons are straightforward once the calendar arithmetic is clear, but several edge cases deserve extra attention.
Same Date of Birth
If two people have exactly the same date of birth, their calendar age difference is:
0 years, 0 months, and 0 days.
Birth times could distinguish who was born first, but birth time is outside a standard date-of-birth age difference calculation.
Same Birthday in Different Years
If two people were born on the same month and day but in different years, the age difference is normally a whole number of years.
For example, April 10, 1990 to April 10, 1995 is exactly five calendar years.
Dates Near the End of a Month
Month-end dates need care because months have different lengths. January 31, February 28, February 29, April 30, and other month-end dates do not behave like equally sized 30-day blocks.
Different software libraries can also express some end-of-month intervals differently. One system may treat January 31 to February 28 as one completed calendar month, while a manual column-borrowing method may describe the elapsed interval differently.
For that reason, use one calculation convention consistently when comparing month-end dates, especially if you are checking a manual result against a calculator.
February 29 and Leap Years
February normally has 28 days, but it has 29 days in a Gregorian leap year. In the Gregorian calendar, years divisible by 4 are generally leap years, except century years unless they are also divisible by 400.
This affects calendar subtraction when the interval crosses February in a leap year, as shown in the borrowing example above.
A person born on February 29 also creates a special birthday case in non-leap years. Different legal systems, applications, and date-calculation conventions may use different rules for treating that birthday outside a leap year, so an age-difference guide should not assume that February 28 or March 1 is universally the correct substitute.
Does the Age Difference Between Two People Change Over Time?
The actual interval between two dates of birth does not change. If two people were born 3 years, 2 months, and 10 days apart, that birth-date interval remains the same as both people get older.
What can change is the difference between their displayed whole-number ages.
Suppose one person has already had a birthday this year but the other person has not. Their ages shown only as whole years may temporarily appear one year farther apart or closer together. That does not mean the true age gap changed. It only reflects where each person is in the current birthday cycle.
How to Check Your Age Difference Calculation
After calculating the age gap manually, check the result instead of assuming the arithmetic is correct.
For ordinary dates, one useful check is to add the calculated interval back to the earlier birth date using the same calendar convention. If the result reaches the later birth date, the calculation is internally consistent.
Using the borrowing example:
October 24, 1990 + 5 years + 4 months + 17 days = March 12, 1996.
You can also enter both dates into an Age Difference Calculator and compare its result with your manual answer.
For month-end or February 29 cases, make sure the calculator and your manual method use the same calendar convention before treating a different decomposition as an arithmetic error.
Age Difference in Years, Months and Days vs Total Days
An age difference can be expressed in more than one useful way.
| Format | What It Represents | Example |
|---|---|---|
| Years, months, and days | A calendar-based decomposition of the interval | 5 years, 7 months, 8 days |
| Total days | The complete elapsed interval counted only in days | 2,048 days |
For the example from April 15, 1990 to November 23, 1995, the age difference can be expressed as 5 years, 7 months, and 8 days or as 2,048 total elapsed days.
These formats describe the same overall span in different ways. You should not convert the calendar result into total days by assuming every month has 30 days or every year has 365 days, because real calendar months and leap years vary in length.
Frequently Asked Questions
Should I round the components or the total? What rounding conventions exist?
Round only after the exact calculation is finished, and state which convention you used, the conventions disagree. Censuses and most legal contexts truncate down to completed years (“age last birthday”): 5 years, 11 months, 30 days becomes 5. Life insurers often do the opposite and use “age nearest birthday,” rounding 5 years, 7 months up to 6. Researchers usually avoid both by converting total days into decimal years (total days ÷ 365.25). Never round the months first and then the years, because rounding 11 months up to a year before finishing the subtraction can fabricate a whole extra year.
Why do Python, Excel, and JavaScript give different age differences for the same dates?
Because no standard defines how a month-end gap becomes “months,” each library invents its own rule. A concrete case: from January 31, 2023 to February 28, 2023. Python’s dateutil.relativedelta reports 0 months and 28 days, because it refuses to count a month it cannot complete. Excel’s DATEDIF with “M” also reports 0 completed months, while DATEDIF with “MD” reports 28 days, but some spreadsheet templates instead clamp February 28 to the boundary and print “1 month.” JavaScript’s date-fns intervalToDuration likewise gives months: 0, days: 28. None of them is buggy; they encode different answers to the question the body’s one generic sentence leaves open, which is why you must record which tool produced a published figure.
What should a calculator do when the later date is entered first?
A well-designed calculator should never silently produce a negative or mixed-sign result. The three common behaviors are: swap the dates automatically and report a positive gap with older/younger labels (the friendliest option for an age tool); refuse with an error, as Excel’s DATEDIF does by returning #NUM! when the start date comes after the end date; or return a signed duration, as SQL’s DATEDIFF does (negative day counts). If you do report a signed interval, put the minus sign on the whole duration, ISO 8601 writes -P3Y2M, never a mix of positive and negative components, and always label which date is the start so readers do not mistake a reversed entry for a real negative age gap.
How do researchers and banks express an age difference as a fraction of a year?
By converting elapsed days into a decimal fraction of a year, but even the denominator is a convention. Medical researchers and growth charts typically divide total days by 365.25, the average Gregorian year, so a 2,048-day gap is about 5.607 years. Astronomers use the Julian year of exactly 365.25 days for the same purpose. Banks go further and pick a day-count convention per contract: “30/360” pretends every month has 30 days, while “Actual/365” counts real days. That means the same two dates can yield slightly different fractional years in a loan document, a clinical trial, and an astronomy paper, so always name the divisor alongside the decimal.
Do time zones or birth times change the age difference?
Not at the date level, but they can change which date you feed the formula. Hospitals record the local time of birth, so a baby born at 11:30 PM on March 3 in New York was born at 4:30 AM on March 4 in London; the birth certificate still says March 3, the local calendar date. Age-difference tools compare calendar dates only, so time zones do not alter the result once the dates are fixed. The practical lesson: when the two people were born in different time zones, record each birth’s local calendar date rather than converting both to one zone, because a UTC conversion can push a near-midnight birth onto the wrong calendar day.
How can I check an age difference without trusting any single tool?
Cross-check with a method that no single calculator controls: the Julian Day Number subtraction. Each calendar date maps to one serial day number (January 1, 2000 is 2,451,544), and subtracting the two serials gives the exact total elapsed days with no month-length conventions involved. Free converters publish the formula, so you can verify the total-days figure on paper: if your tool’s total days disagree with the serial subtraction, the tool or your data entry is wrong, never the arithmetic. For the years-months-days form, also add the interval back to the earlier birth date by hand; if you do not land exactly on the later date, the month borrowing was off.
Date and age rules can vary by organization or jurisdiction. For official eligibility or legal deadlines, confirm the applicable rule with the relevant authority.
