Calculator
Earth takes about 365.2422 days to orbit the Sun. A calendar can't have 0.2422 of a day, so every calendar since antiquity has had to fudge it somehow.
A calendar year of exactly 365 days is a convenient round number, but it's not what the sky actually does. The time it takes Earth to complete one orbit around the Sun, measured against the seasons (the tropical year), is about 365.2422 days.
Ignore that 0.2422-day gap and it compounds fast: after just 4 years, the calendar would be off by nearly a full day (4 ร 0.2422 โ 0.97). After 100 years, off by about 24 days. Keep ignoring it for a few centuries and January drifts into what used to be summer. Leap years exist purely to cancel out that drift by inserting an extra day, February 29, often enough to keep the calendar lined up with the actual orbit.
Type in a year and see exactly which rule decides whether it gets a February 29.
The simple "every 4 years" rule comes from the Julian calendar, introduced by Julius Caesar in 46 BCE. It assumed a year of exactly 365.25 days: one leap day every 4 years, no exceptions. That's a good approximation, but not a perfect one; 365.25 overshoots the real 365.2422 by 0.0078 days a year. Small on its own, but it adds up to a full extra day roughly every 128 years.
By 1582, that drift had pushed the Julian calendar about 10 days out of sync with the seasons; the spring equinox was landing on March 11 instead of March 21. Pope Gregory XIII fixed it with two changes: he deleted 10 days from the calendar outright (October 4, 1582 was followed directly by October 15), and he added the century-year exception so the same error couldn't reaccumulate. Century years (1700, 1800, 1900, 2000...) are only leap years if divisible by 400. That knocks out 3 leap days every 400 years, which is exactly the correction needed.
This is the only part of the rule that actually trips people up; every other year just follows "divisible by 4." Here's how the last and next several century years shake out:
| Year | รท 100 | รท 400 | Result |
|---|---|---|---|
| 1600 | Yes | Yes | Leap year |
| 1700 | Yes | No | Not a leap year |
| 1800 | Yes | No | Not a leap year |
| 1900 | Yes | No | Not a leap year |
| 2000 | Yes | Yes | Leap year |
| 2100 | Yes | No | Not a leap year |
| 2200 | Yes | No | Not a leap year |
| 2300 | Yes | No | Not a leap year |
| 2400 | Yes | Yes | Leap year |
Anyone born in 1896 or earlier lived through a leap year that broke the pattern people expected. 1900 felt like it should have been a leap year (divisible by 4), but it wasn't, because it's divisible by 100 and not by 400. 2000 looked the same on paper, but it was a leap year, because 2000 รท 400 = 5 exactly. The next time this exception actually matters is 2100.
The Gregorian rule gives an average calendar year of 365.2425 days (365 days, plus a leap day in 97 of every 400 years: 97 รท 400 = 0.2425). Compare that to the real tropical year of 365.2422 days, and the remaining error is tiny: about 0.0003 days a year, roughly 26 seconds.
That's about 26 times more accurate than the calendar it replaced, achieved with one extra exception layered on top of a 2,000-year-old rule. Nobody living today needs to worry about the leftover drift; it won't matter until roughly the year 5000.