Checking the century exception in the Gregorian leap-year rule
A year divisible by four is not automatically a leap year in the Gregorian calendar. This guide explains the century exception and the four-hundred-year exception to it, using 1900 and 2000 as the worked cases.
The three-part rule in plain terms
The Gregorian leap-year rule has three layers. A year divisible by 4 is a leap year. An exception removes years divisible by 100, which makes them common years. A second exception restores years divisible by 400, which are leap years again. The Leap Year Calculator writes this as one condition: the year is divisible by 4, and either it is not divisible by 100 or it is divisible by 400. Years that do not divide by 4 never qualify. Most people only meet the first layer in everyday life, since ordinary years like 2024 follow it directly. The extra layers matter only for century years, which is why the pair 1900 and 2000 is the classic test. They look identical to a divisibility-by-four check, and the calculator separates them with the century rules.
Working through 1900
Start with 1900. It divides by 4, since 1900 divided by 4 is 475. A simple rule would call it a leap year. Then apply the century check: 1900 divided by 100 is 19, so it is a century year and the exception removes it. Finally ask whether it divides by 400. 1900 divided by 400 is 4.75, so it does not, and the exception to the exception never applies. The year 1900 therefore has 365 days, with February ending on the 28th. The same logic removes 2100, 2200 and 2300 from the leap-year list. Anyone building a date table that spans 1900 or 2100 should expect these years to behave like ordinary common years, and a test case for either one is a quick way to find out whether a system implements the full rule.
Working through 2000
The year 2000 also divides by 4 and by 100. If the rule stopped after the century exception, 2000 would be a common year. The final layer restores it: 2000 divided by 400 is exactly 5, so it is a leap year with 366 days. This is the reason the year 2000 was an unusual one for software testers. Programs written only with the divide-by-4 rule happened to give the right answer for 2000, while programs with the century exception but without the 400 restoration got it wrong. A correct implementation handles both. The two worked cases therefore test opposite outcomes of the same branch, and a calculator that returns true for 2000 and false for 1900 is applying all three layers.
Why the rule exists
The calendar year is meant to track the tropical year, the time between successive March equinoxes, which is about 365.2422 days. A calendar with 365 days drifts ahead of the seasons by almost a quarter day each year. The Julian calendar used a leap day every fourth year, an average of 365.25 days, which overshoots by roughly 11 minutes a year and accumulates to about one day every 128 years. By the sixteenth century the equinox had moved about ten days from its intended date. The Gregorian reform removed three leap days every 400 years by dropping the century leap days except those divisible by 400. That yields an average of 365.2425 days, close enough that the calendar year differs from the tropical year by about one day in 3,000 years.
The 400-year cycle
Counting the exceptions gives a neat structure. In any 400 consecutive years there are 100 years divisible by 4. Four of those are century years, and only one of the four is divisible by 400, so three are removed. That leaves 97 leap years in each 400-year cycle. The total length of the cycle is 400 times 365 plus 97, which is 146,097 days. Since 146,097 divided by 7 is exactly 20,871, the cycle is a whole number of weeks. The Gregorian calendar therefore repeats its weekday pattern every 400 years: a given date falls on the same weekday 400 years later. That is why the average year of 365.2425 days equals 146,097 divided by 400. It also explains why calendar software can use a 400-year block to speed up day-of-week calculations.
Other years worth testing
A short set of test years covers every branch of the rule. The year 2023 does not divide by 4, so it is common. The year 2024 divides by 4 and is not a century year, so it is a leap year with 366 days. The year 1600 divides by 400, so it is a leap year, and 1700, 1800 and 1900 are common years. The year 2100 is a common year, which matters for date systems that will run beyond it. Each of these takes only a moment in the Leap Year Calculator, and each exercises a different path through the condition. If a spreadsheet or program gives a different answer for one of these years, the formula is missing a layer or applying the layers in the wrong order.
Where the model stops: proleptic dates
The calculator applies the Gregorian rule to any whole year from 1 to 9999 and rejects values outside that range, including years before the calendar was introduced. Mathematicians and standards such as ISO 8601 call this the proleptic Gregorian calendar, meaning the rule is projected backward. It is convenient for computation and consistent across a program, but it is not a statement about what calendar people used in a particular place and time. The result for 1500 or 1000 is the answer the Gregorian rule would give, and nobody at the time was using that rule. For historical records, first identify the calendar of the source before applying any modern leap-year test. A date written in the Julian calendar has a different set of leap years, including 1900, which was a leap year in the Julian system.
Adoption dates and archival work
The Gregorian reform was announced by Pope Gregory XIII in 1582, and the first adopters skipped from October 4 to October 15 of that year. Other countries followed over centuries. Great Britain and its colonies changed in 1752, when September 2 was followed by September 14. Russia adopted the calendar in 1918 and Greece in 1923. During the transition, documents can carry dual dates or use one system while a neighbor used the other. Researchers working with archives should check the convention noted in the source. The leap-year calculator gives the correct count of days in a Gregorian year, but it cannot tell whether a given historical date was recorded in the Gregorian or Julian system, so that determination comes first.
Common mistakes in spreadsheets and code
The most frequent bug is testing divisibility by 4 and stopping. Another is writing the century check with the wrong logic, for example requiring the year to be divisible by 100 and 400 in a way that removes 2000. The order of conditions matters too. Testing 400 first, then 100, then 4, avoids nested errors. A famous historical example is spreadsheet software that treats 1900 as a leap year, a behavior kept for compatibility with an earlier program, and which gives day 60 of the serial date system a February 29 that did not exist. When you build a calendar tool, test against 1900 and 2000 together. The pair catches both missing layers at once, and the Leap Year Calculator shows what the correct output looks like for each.
Counting days across a century
The century exception shows up directly when you count days between two dates. From January 1, 1900 to January 1, 2000 there are 100 years. The leap years inside that span are the multiples of 4 from 1904 through 1996, which is 24 of them, and 1900 itself contributes none. The total is 100 times 365 plus 24, or 36,524 days. A system that wrongly treated 1900 as a leap year would report 36,525. For the next century, January 1, 2000 to January 1, 2100 contains the leap years 2000, 2004 and on through 2096, which is 25 of them, so the span is 36,525 days. One day of difference between two centuries comes entirely from the 400 rule. Bugs of this type are easy to miss because they only show up in date ranges that cross a century boundary.
Date validation and February 29
The rule decides whether a particular date exists. February 29, 2000 is valid and February 29, 1900 is not. A form that validates birth dates, a booking system that accepts check-in days, or an import script that parses text dates all need the full test, otherwise they either reject legitimate leap-day dates in 2000 or accept a nonexistent one in 1900 or 2100. The day count also changes the ordinal date. December 31 is day 366 in 2000 and day 365 in 1900, and ISO 8601 ordinal dates rely on that difference. For software that tracks anniversaries on February 29, a separate policy is needed for common years, such as moving to February 28 or March 1. The leap-year result supplies the facts, and the business rule decides what to do with them.
Leap days and leap seconds are separate
People sometimes confuse the leap-year rule with leap seconds. A leap day is a calendar rule that anyone can compute in advance from the year number, which is why the Leap Year Calculator needs no data beyond the year. Leap seconds are different. They are occasional one-second adjustments to Coordinated Universal Time, announced by the International Earth Rotation and Reference Systems Service because Earth rotation is irregular, and they follow no formula. A year can have 365 or 366 days according to the Gregorian rule while also containing a leap second in UTC. The two corrections address different problems: the calendar tracks the seasons, and UTC tracks Earth rotation. The calculator reports only the day count that follows from the Gregorian rule.
Reproduce the checks
Century exception
Open the Leap Year Calculator and enter:
- Year
1900
Expected output:
Leap
falseDays
365Divisibility by four is not sufficient here.
Four-hundred-year exception
Open the Leap Year Calculator and enter:
- Year
2000
Expected output:
Leap
trueDays
366The full rule restores the leap day.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08