Age Calculator
Enter a date of birth to get an exact age in years, months and days, plus total weeks, days and hours and a countdown to the next birthday.
Age Difference Between Two People
How to Calculate Age from Date of Birth
Age is not a number of days divided by something. It is a count of birthdays: you are 36 on the day of your 36th birthday and stay 36 until the day of your 37th. This age calculator works the same way. It finds the latest whole month since your date of birth that has already arrived, counts whole years and the leftover months from that, and then counts the days from that anniversary to the "age on" date.
Take someone born on 15 May 1990 and the date 23 October 2026. Their 36th birthday was 15 May 2026, so they are 36 years old. The fifth monthly anniversary after that was 15 October 2026, so the months part is 5. From 15 October to 23 October is 8 days. The age is 36 years, 5 months, 8 days, which is exactly what the calculator shows for those two dates.
The "age on" date starts as today, taken from your device's clock, but you can set it to any date — past or future. That answers questions like "how old was I on 1 January 2000?", "how old will I be at graduation?" or "what age was someone on the day a document was signed?". Every date from year 1 to year 9999 is supported, counted in the Gregorian calendar.
All the arithmetic is done on whole calendar days, without JavaScript Date objects, so your time zone and daylight saving changes cannot shift the answer by a day. That matters more than it sounds: the most common bug in age code is a date that silently moves to the previous day.
Age Calculator by Date of Birth: Worked Examples
Each row below was entered into the calculator above and the result copied from it. The last two columns show where the two choices for 29 February and month-end birthdays give different answers.
| Date of birth | Age on | Age (28 February rule) | Age (1 March rule) |
|---|---|---|---|
| 15 May 1990 | 23 Oct 2026 | 36 years, 5 months, 8 days | same |
| 1 Mar 2000 | 1 Mar 2001 | 1 year, 0 months, 0 days | same |
| 1 Nov 2025 | 23 Oct 2026 | 0 years, 11 months, 22 days | same |
| 29 Feb 2000 | 23 Oct 2026 | 26 years, 7 months, 24 days | same |
| 29 Feb 2000 | 28 Feb 2027 | 27 years, 0 months, 0 days | 26 years, 11 months, 30 days |
| 31 Jan 2000 | 1 Mar 2000 | 0 years, 1 month, 1 day | 0 years, 1 month, 0 days |
| 31 Jan 2000 | 30 Mar 2000 | 0 years, 1 month, 30 days | 0 years, 1 month, 29 days |
The last row surprises people. On 30 March the second monthly anniversary of 31 January has not happened yet — it is 31 March — so the age is still 1 month plus the days since the first anniversary. Under the 28 February rule that anniversary is 29 February (the last day of that February), giving 30 days; under the 1 March rule it is 1 March, giving 29. One day later both say exactly 2 months. Any calendar-correct calculator has edges like this, because months are not all the same length; the honest thing is to pick one rule and apply it every time.
Age in Months, Weeks, Days and Hours
Below the main result the calculator lists the same age as totals. For the 15 May 1990 example on 23 October 2026 those are:
| Unit | Age | How it is counted |
|---|---|---|
| Months | 437 + 8 days | Whole monthly anniversaries since birth, plus the days since the last one |
| Weeks | 1,901 weeks, 3 days | Total days divided by 7, with the remainder |
| Days | 13,310 | Calendar days from the date of birth to the "age on" date |
| Hours | 319,440 | Total days × 24 |
The day count does not include the birth date itself, the same way someone born today is 0 days old. Hours are whole days times 24, counted from midnight to midnight, because a date of birth on its own has no time of day. If you know the time you were born, add or subtract the difference yourself; an hour-precise age also depends on the time zone you were born in.
Totals are where approximate formulas break first. A year is 365 or 366 days and a month is 28 to 31, so "years × 365" or "months × 30" drifts by a day or more every few years. The calculator counts the real days between the two dates, so 1 March 2000 to 1 March 2001 is 365 days and 1 March 2003 to 1 March 2004 is 366.
Birthday Calculator: Days Until Your Next Birthday
The Next birthday box gives the date of the next birthday, the day of the week it falls on, how many days are left and the age you will turn. For someone born on 15 May 1990, on 23 October 2026 it reads 15 May 2027 (Saturday), in 204 days, turning 37. When the "age on" date is a birthday, the box says so instead of counting down to next year.
The Born on a box gives the day of the week of the date of birth — 15 May 1990 was a Tuesday. Weekdays are computed from the date itself, so they are correct for any year back to year 1 in the Gregorian calendar (dates before the calendar was adopted in 1582, and later in many countries, are counted as if it had always been in use).
Leap Year Birthdays: When Does a 29 February Baby Turn a Year Older?
About one day in 1,461 is 29 February, and people born on it have a real question three years out of four: is the birthday on 28 February or 1 March? There is no universal answer. Different countries, and different organisations within them, use one or the other for things like driving licences, pensions and age limits. So the calculator does not choose for you — the 29 February birthdays in other years fall on setting switches between the two.
- 28 February (the default) — in a common year the birthday is the last day of February. Someone born on 29 February 2000 turns 27 on 28 February 2027.
- 1 March — the birthday is the day after 28 February. The same person is 26 years, 11 months, 30 days on 28 February 2027 and turns 27 on 1 March 2027.
The same setting applies to every date that does not exist in a given month, not just 29 February. Someone born on 31 January has a monthly anniversary on 28 or 29 February (or 1 March) and on 30 April (or 1 May). That only changes the months-and-days part of an age, never the years — except for 29 February, the only date of birth whose yearly birthday can fall on a day that does not exist.
Most age formulas in code quietly pick 1 March without saying so. The common "subtract the years, then take one off if the birthday has not happened yet" check compares month and day, and 28 February comes before 29 February, so the code decides the birthday has not arrived until 1 March. If your rule is 28 February, that is a one-day bug every common year.
Common Mistakes When Calculating Age
- Dividing days by 365.25. It looks careful, but it is wrong on birthdays. From 1 March 2000 to 1 March 2001 is 365 days, and 365 ÷ 365.25 = 0.9993, which rounds down to 0. The person turned 1 that day. The error comes and goes depending on where the leap years fall, which is why it slips through testing.
- Subtracting the years only. 2026 − 1990 = 36 is the right age only after the birthday. Before 15 May the answer must be 35, so you always have to compare the month and day as well.
- Parsing
YYYY-MM-DDwithnew Date()in JavaScript.new Date('2000-03-01')is midnight UTC. Read back withgetDate()in New York it returns 29 — the date has moved to 29 February because local time is still the previous evening. Build local dates withnew Date(2000, 2, 1)(months start at 0) or keep dates as plain year, month and day numbers. - Counting months as 30 days. From 1 February 2001 to 1 April 2001 is 59 days. On the calendar that is exactly 2 months; at 30 days a month it comes out as 1 month and 29 days.
- Mixing time zones for "today". A server in UTC and a user in Sydney can disagree about what today's date is for up to 11 hours. Decide whose today counts — usually the user's — and pass that date to the calculation instead of letting each side read its own clock.
If your ages come from timestamps rather than dates, convert first: our Unix timestamp converter turns an epoch value into a calendar date, and the date is what an age is counted from.
How to Calculate Age in Code
For whole years, compare the month and day after subtracting the years. In JavaScript, using local-time dates:
function ageInYears(birth, on) {
let years = on.getFullYear() - birth.getFullYear();
const hadBirthday =
on.getMonth() > birth.getMonth() ||
(on.getMonth() === birth.getMonth() && on.getDate() >= birth.getDate());
if (!hadBirthday) years--;
return years;
}
ageInYears(new Date(1990, 4, 15), new Date(2026, 9, 23)); // 36
ageInYears(new Date(2000, 1, 29), new Date(2027, 1, 28)); // 26 (1 March rule)
In Python, tuples compare element by element, which makes the same check one line:
from datetime import date
def age(born, on):
return on.year - born.year - ((on.month, on.day) < (born.month, born.day))
age(date(1990, 5, 15), date(2026, 10, 23)) # 36
age(date(2000, 2, 29), date(2027, 3, 1)) # 27
Both snippets follow the 1 March rule for leap-day birthdays, as explained above. For a 28 February rule, treat a 29 February birth date as 28 February when the "age on" year is not a leap year.
In Excel and Google Sheets, =DATEDIF(A2, TODAY(), "Y") gives whole years and =DATEDIF(A2, TODAY(), "YM") the months after the last birthday. Microsoft's documentation warns that the "MD" unit (days after the last whole month) can return wrong results, so compute the days part another way if you need it.
Years, months and days together take more care, because you have to decide what happens on the 29th, 30th and 31st. The approach this page uses is short: count the months between the two dates, step back one if that anniversary is still in the future, and count the remaining days. A JSON API that returns dates of birth is easier to check with our JSON formatter open, and the regex tester will confirm a ^\d{4}-\d{2}-\d{2}$ pattern accepts the dates you expect before they reach your age code.