HomeEveryday Life › Leap Year Calculator

Leap Year Calculator

Applies the Gregorian leap-year rule (divisible by 4, except centuries not divisible by 400) to a year and reports the reason, the number of days in the year and in February, and the next and previous leap years.

When to use

You need to know whether a year has 29 February, why, or when the next leap year occurs.

Do not use when: You need the weekday or ISO week of a specific date (use day-of-week) or day counts between dates (use date-difference).

Formula

is_leap = (year mod 4 = 0 and year mod 100 ≠ 0) or year mod 400 = 0

The Gregorian rule gives a mean year of 365.2425 days. Years before 1582 (or before a country's adoption date) were actually reckoned in the Julian calendar, where every fourth year is leap; this calculator applies the Gregorian rule proleptically.

Inputs

ParameterTypeUnitRequiredDescription
yearintegeryesYear in the (proleptic) Gregorian calendar. Range: ≥ 1, ≤ 9999

Outputs

OutputTypeUnitDescription
is_leapbooleantrue when the year has 366 days.
reasonstringWhich part of the rule decided the result.
days_in_yearintegerdays365 or 366.
days_in_februaryintegerdays28 or 29.
next_leap_yearintegerFirst leap year after the given year.
previous_leap_yearintegerLast leap year before the given year (absent for years before 4).

Example

2024: {"year":2024}{"is_leap":true,"reason":"Divisible by 4 and not by 100","days_in_year":366,"days_in_february":29,"next_leap_year":2028,"previous_leap_year":2020}

1900 (century year not divisible by 400): {"year":1900}{"is_leap":false,"reason":"Divisible by 100 but not by 400","days_in_year":365,"days_in_february":28,"next_leap_year":1904,"previous_leap_year":1896}

GET https://tttkmbb.com/api/v1/calculate/leap-year?year=2024

Machine access

Sources

FAQ

Was 2000 a leap year?

Yes: it is divisible by 400. 1900 and 2100 are not leap years because they are divisible by 100 but not by 400.

Why does the rule skip some century years?

A solar year is about 365.2422 days; adding a day every 4 years overshoots, so 3 leap days are dropped every 400 years to keep the calendar aligned with the seasons.

Related calculators