The Three-Part Gregorian Leap Year Algorithm
The leap year rule consists of three nested conditions that progressively refine calendar accuracy.
- First, any year divisible by 4 is a candidate leap year — this basic cycle corrects for the 0.2422-day annual surplus.
- Second, century years (divisible by 100) are excluded from leap years because the four-year correction overcounts by 0.0078 days per cycle, accumulating to about 3 extra days every 400 years.
- Third, years divisible by 400 are restored as leap years, putting back one of those three skipped days.
The result: 400 years contain exactly 97 leap years (not 100), producing an average year length of 365.2425 days.
Recent examples illustrate the rule:
- 2024 was a leap year (divisible by 4, not a century year).
- 1900 was NOT a leap year (divisible by 100 but not 400).
- 2000 WAS a leap year (divisible by 400).
The next century-year exception is 2100, which will not be a leap year despite being divisible by 4.