Understanding the leap year calculator — concept and principle
A leap year has 366 days instead of 365, with an extra day added as February 29. Knowing whether a year is a leap year matters for counting days between dates, interest and payroll schedules, and date-handling software. Enter any year and the calculator tells you whether it is a leap year, how many days February has, and the previous and next leap years.
How it is calculated
The calculator applies the Gregorian calendar rule in three steps:
- If the year is divisible by 400, it is a leap year.
- Otherwise, if it is divisible by 100, it is a common year.
- Otherwise, if it is divisible by 4, it is a leap year; if not, it is a common year.
To find the previous and next leap years, it steps one year at a time backwards and forwards until the rule is satisfied. Decimal inputs are rounded down to a whole year.
The principle
The calendar tries to keep pace with the tropical year, the time from one March equinox to the next, which is about 365.2422 days. A 365-day calendar falls behind by almost a quarter of a day each year. The Julian calendar fixed this by adding a day every four years, giving an average of 365.25 days, which is slightly too long. Over centuries the equinox drifted earlier, so in 1582 Pope Gregory XIII introduced the current rule that drops three leap days every 400 years. That leaves 97 leap years per 400 years and an average year of 365 + 97/400 = 365.2425 days, very close to the tropical year.
Worked example
- Default input: year 2028.
- 2028 ÷ 400 = 5.07, not a whole number, so step 1 does not apply.
- 2028 ÷ 100 = 20.28, not a whole number, so step 2 does not apply.
- 2028 ÷ 4 = 507 exactly, so 2028 is a leap year (366 days) and February has 29 days.
- Searching outward, the previous leap year is 2024 and the next is 2032.
How to read the result
Most leap years are four years apart, but around a century year that is not divisible by 400 the gap is eight years: 2096 is followed by 2104 because 2100 is a common year. The years 1600 and 2000 were leap years; 1700, 1800, 1900 and 2100 are not. A full 400-year cycle has 146,097 days, which is exactly 20,871 weeks, so the calendar repeats its weekdays every 400 years.
Common mistakes
- Using only the "divisible by 4" rule, which wrongly makes 1900 and 2100 leap years.
- Assuming a year always has 52 weeks and one day; a leap year has 52 weeks and two days.
- Applying the Gregorian rule to dates before a country adopted the Gregorian calendar.
Frequently asked questions
Is 2028 a leap year?
Yes. It is divisible by 4 and not by 100.
Was 2000 a leap year?
Yes. It is divisible by 400, so the century exception does not apply.
Is a leap second the same as a leap year?
No. Leap seconds were added to UTC to follow Earth's rotation; leap years keep the calendar in step with the seasons.
Sources: E. G. Richards, Mapping Time: The Calendar and its History, Oxford University Press, 1998 · U.S. Naval Observatory, Explanatory Supplement to the Astronomical Almanac