Menu
Advertisement

Age Difference Calculator for Two People

Enter two dates of birth to see how much older one person is, in years, months and days.

By Nethanel Bar, Co-founder & CEO

Last updated

Advertisement

Ready to actually learn to code?

Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.

How much older is one person than the other?

The age gap between two people never changes: it is the time from the earlier date of birth to the later one. The tool counts it the same way as an age, with whole years, then whole months, then the days left. Siblings born on June 12, 2015 and February 3, 2018 are 2 years, 7 months and 22 days apart for life.

The difference between their ages in whole years does change during the year, and that is what confuses people. Take someone born on March 10, 1990 and someone born on October 20, 1993, 3 years, 7 months and 10 days apart. From March 10 to October 19 the first has had a birthday and the second has not, so their ages differ by 4. The rest of the year they differ by 3.

It works for siblings, couples, a parent and a child, or any two dates from 1900 to 2100. When both dates are the same, it says they were born on the same day. The dates are compared in your browser and not sent anywhere.

What you will learn from an age gap

  • A gap between two fixed dates never changes, but the difference between two ages in whole years moves between two numbers during the year.
  • A gap in different units is not a simple multiple. 3 years, 7 months and 10 days is 43 months but 1,320 days, because months and years vary in length.
  • The order of the dates changes who is older, not the size of the gap.
  • Sorting before you subtract is a common step in code. In Python, sorted() puts the earlier date first, and relativedelta from the dateutil library gives the years, months and days between them.

How to find the age difference

  1. Enter the first date of birth

    Choose the month and the day, and type the year, for the first person.

  2. Enter the second date of birth

    Do the same for the second person. The order does not matter.

  3. Read the gap

    The result shows the gap in years, months and days and says who is older. Below it is the same gap in months, weeks and days.

Age gaps, worked out

Pairs of dates of birth and the gap the tool shows for them. The weeks it shows are whole weeks.

First personSecond personAge gapIn days
June 12, 2015February 3, 20182 years, 7 months, 22 days967
March 10, 1990October 20, 19933 years, 7 months, 10 days1,320
November 2, 1985April 17, 19915 years, 5 months, 15 days1,992
August 30, 1962January 5, 199431 years, 4 months, 6 days11,451
February 29, 2000February 28, 20011 year365
May 9, 2012May 9, 20120 days, born on the same day0

Age gaps to try

Two siblings

Paste a small example into the tool and change one part at a time.

The tool shows 2 years, 7 months, 22 days and says the first person is older. Below it: 31 months, 138 weeks and 967 days.

A couple, younger person first

Copy the original value, run the tool, then compare the result.

The order does not change the gap: 3 years, 6 months, 15 days, or 1,293 days. The tool says the second person is older.

February 29 and February 28 a year later

Take a value from your own work and use this tool to inspect or prepare it.

One year after February 29, 2000 is February 28, 2001, since 2001 has no February 29. The tool shows a gap of exactly 1 year, or 365 days.

The age gap in Python

dateutil
from datetime import datefrom dateutil.relativedelta import relativedelta
a = date(1993, 10, 20)b = date(1990, 3, 10)older, younger = sorted([a, b])gap = relativedelta(younger, older)print(f"{gap.years} years, {gap.months} months, {gap.days} days")print(gap.years * 12 + gap.months, "months")

sorted puts the earlier date of birth first, so the gap is never negative. It prints 3 years, 7 months, 10 days and then 43 months, as the tool does.

Age gap mistakes

  • Subtracting birth years. 1993 minus 1990 says 3, but people born on March 10, 1990 and October 20, 1993 have ages 4 apart from March 10 to October 19 each year.
  • Comparing one person's age today with the other's age at their last birthday. Compare the dates of birth instead, which is what the tool does.
  • Dividing the days by 365 to get years. Leap days add up, and the months and days are lost.
  • Expecting the gap to grow or shrink over time. It is fixed from the day the younger person is born.

Age difference FAQ

How do I calculate the age difference between two people?

Count from the earlier date of birth to the later one: whole years, then whole months, then days. Enter both dates here and the tool does it and says who is older.

Does it matter which date of birth I enter first?

No. The gap is the same either way, and the tool tells you whether the first or the second person is older.

Why do our ages differ by one more year for part of the year?

From the older person's birthday until the younger person's birthday, the older one has already gone up a year. In that stretch the ages differ by one more than the whole years in the gap.

What does the tool show for twins?

A gap of 0 days and the line They were born on the same day. It compares dates, not birth times, so it cannot say which twin is older.

Can I see how much older someone is in months or weeks?

Yes. Under the gap, the tool shows it in months, in whole weeks and in days.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

Get started