Age calculator

Calculate age in years, months and days at a chosen reference date.

Gregorian civil dates from years 0001 to 9999, without time or timezone. Monthly anniversaries remain anchored to the birth day, clamped to the last day of shorter months. February 29 becomes February 28 in non-leap years. A calculation convention, not a determination of legal age. Example: January 31 to February 29, 2024 = 0 years, 1 month, 0 days.

Your dates and times stay in your browser and are not stored.

Method and assumptions

Method version 1.0.0 · Updated

Age at a date

Formula: Complete calendar months → years + months; remaining days

Gregorian civil dates from years 0001 to 9999, without time or timezone. Monthly anniversaries remain anchored to the birth day, clamped to the last day of shorter months. February 29 becomes February 28 in non-leap years. A calculation convention, not a determination of legal age. Example: January 31 to February 29, 2024 = 0 years, 1 month, 0 days.

birth
Date of birth
reference
Reference date

Gregorian calendar from years 0001 to 9999. Date, duration and rounding conventions are specified for each mode.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const birth = new Date('2000-01-15T00:00:00Z');
const today = new Date('2026-01-20T00:00:00Z');
let years = today.getUTCFullYear() - birth.getUTCFullYear();
if (today.getUTCMonth() < birth.getUTCMonth() || (today.getUTCMonth() === birth.getUTCMonth() && today.getUTCDate() < birth.getUTCDate())) years--;
console.log(years); // 26 complete years
TypeScript
const birth = new Date('2000-01-15T00:00:00Z');
const today = new Date('2026-01-20T00:00:00Z');
let years: number = today.getUTCFullYear() - birth.getUTCFullYear();
if (today.getUTCMonth() < birth.getUTCMonth() || (today.getUTCMonth() === birth.getUTCMonth() && today.getUTCDate() < birth.getUTCDate())) years--;
console.log(years); // 26 complete years
Python
from datetime import date
birth, today = date(2000, 1, 15), date(2026, 1, 20)
years = today.year - birth.year - ((today.month, today.day) < (birth.month, birth.day))
print(years)  # 26 complete years
Java
var birth = java.time.LocalDate.of(2000, 1, 15);
var today = java.time.LocalDate.of(2026, 1, 20);
System.out.println(java.time.Period.between(birth, today).getYears()); // 26
C#
var birth = new DateOnly(2000, 1, 15);
var today = new DateOnly(2026, 1, 20);
int years = today.Year - birth.Year - (today < birth.AddYears(today.Year - birth.Year) ? 1 : 0);
Console.WriteLine(years); // 26