A little help goes a long way. Find a tool/

Time FIELD NOTES · 4 MIN READ

How Leap Years Work

The Gregorian leap rule — divisible by 4, except centuries unless by 400 — and why 97 leap years per 400 keep the calendar aligned.

Every four years February gains a day — except when it doesn't, except when it does. The full rule has a century-sized exception and a four-century-sized exception on top of the familiar "divisible by four," because the Earth stubbornly refuses to take 365 days to circle the Sun.

The problem: a year is not 365 days

The tropical year — one cycle of the seasons, equinox to equinox — takes about 365.2422 days. A 365-day calendar runs fast by 0.2422 of a day each year: skip the correction entirely and the calendar drifts one full day against the seasons roughly every four years, so after a few centuries "midsummer" falls in what should be spring. The fix is to occasionally stretch the year to 366 days by adding February 29. The entire history of calendar reform is the story of getting that "occasionally" exactly right, because the correction itself must average out to 0.2422 of a day per year.

The Gregorian rule

The rule in force across most of the world since 1582 is short enough to memorize, and it is exactly what a leap year checker implements:

leap if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0

2024 → leap        (divisible by 4, not by 100)
2025 → not         (not divisible by 4)
2000 → leap        (divisible by 400 — the century exception)
1900 → not         (divisible by 100, not by 400)
2100 → not         (same reason — 97 years from now)
2400 → leap        (divisible by 400)

Out of every 400 years, exactly 97 are leap years (100 divisible by 4, minus 100 divisible by 100, plus 4 divisible by 400). That makes the average Gregorian year 365 + 97/400 = 365.2425 days — within half a minute per year of the true 365.2422, so the calendar takes roughly 3,300 years to drift a single day. That residual is small enough that no correction is scheduled; proposals to drop a leap day in the year 4000-class cycles have never been adopted.

Why centuries are special

Dividing by four is the obvious fix (365.25-day average — the Julian calendar's rule since 45 BCE), but 0.25 is slightly too generous: it overshoots by about 0.0078 days per year, roughly 11 minutes. Eleven minutes sounds harmless until you compound it: 125 years per full day of drift. By 1582 the Julian calendar was ten days ahead of the seasons — the spring equinox, meant to fall March 21, landed March 11, which threw off the date of Easter. Pope Gregory XIII's reform deleted ten days that October (Thursday October 4 was followed by Friday October 15) and installed the divisible-by-100/400 exception, which removes three leap days every four centuries — precisely enough to undo the Julian overshoot. The century rule is why 2000 was a leap year but 1900 and 2100 are not: only centuries divisible by 400 survive the second cut.

What leap years mean for date math

February 29 breaks three everyday assumptions. First, year arithmetic: a person born February 29, 2004 has had only five "real" birthdays by 2024, though most age calculators treat them as turning a year older on March 1 in non-leap years (some use February 28) — the age is computed from the elapsed calendar, not from a count of birthdays celebrated. Second, day differences: the gap between March 1 and any date before it contains an extra day in leap years, so "same date, next year" can be 366 days apart. Exact day counts are safe — subtracting two calendar dates handles February 29 automatically — but converting a day count into years by dividing is not, because months vary: a 1,000-day span is 2.7 years on a 365-day year and 2.6 on a 366-day one, which is why quick tools report years and months as approximations (a 365.25-day year, a 30.44-day month). The reliable method is to walk the calendar year by year and month by month, counting whole years first, exactly the approach described in how a date countdown works. Every one of these edge cases concentrates on February, which is why date libraries are famous for their February test suites.

Try it yourself

Test any year — including 1900, 2000, 2100, and 2400 to see the century rule fire — with the Leap Year Checker, which also states why: divisible by 4 but not 100, divisible by 400, and so on. Measure a real span that crosses one or more February 29ths with the Date Difference tool, and see how a birthday lands year by year with the Age Calculator.

Frequently asked questions

What is the rule for leap years?
A year is a leap year if it is divisible by 4 — except century years (divisible by 100), which must also be divisible by 400. As a formula: (year % 4 == 0 and year % 100 != 0) or year % 400 == 0. So 2024 is a leap year, 2025 is not, 2000 was, and 1900 and 2100 are not.
Why was 2000 a leap year but 2100 will not be?
The century exception. Ordinary century years (divisible by 100) drop their leap day so the calendar does not overshoot, but every fourth one — divisible by 400 — keeps it. 1600 and 2000 are divisible by 400, so they were leap years; 1700, 1800, 1900, and 2100 are not.
How many leap years are in 400 years?
Exactly 97: 100 years divisible by 4, minus 100 also divisible by 100, plus 4 divisible by 400. That averages 365.2425 days per year — within about half a minute per year of the true 365.2422 — and it makes the 400-year cycle exactly 146,097 days, which is divisible by 7, so the calendar repeats every 400 years.
Why do we need leap years at all?
The tropical year — one cycle of the seasons — takes about 365.2422 days, not 365. A pure 365-day calendar drifts nearly a day every four years, so seasons would slide across the calendar. Leap days insert the missing quarter-days; the century exceptions fine-tune the correction so the average year matches the astronomical one.
What happens if you are born on February 29?
You get an actual birthday only in leap years, but your age still increases every year: calculators treat a February 29 birthday as turning a year older on March 1 in non-leap years (some conventions use February 28). In year/month/day output the missing day is absorbed by the borrow logic of the calendar math.