Time

How Leap Years Actually Work: Four, a Hundred, Four Hundred

Every fourth year, except centuries, unless the century divides by 400. Why the rule exists, what 1582 skipped, and the bugs a 29 February keeps causing.

A row of year ticks with a tall bar on every fourth one, a long arc over the row, and the last bar drawn as an empty outline with a dot inside.

A year is a leap year if it divides by 4, except that a year divisible by 100 is not, unless it is also divisible by 400. So 2024 was a leap year, 1900 and 2100 are not, and 2000 was. The rule exists because the Earth takes about 365.2422 days to go round the Sun, not 365, and a calendar that ignores the extra quarter day drifts against the seasons by roughly a day every four years.

Why does a year need an extra day at all?

The seasons follow the Sun, not the calendar. The interval from one March equinox to the next averages about 365.2422 days (the tropical year). A calendar of 365-day years falls behind that by almost six hours a year. After four years it is a day behind, after a century about 24 days, and midsummer starts moving toward spring.

The fix Julius Caesar's calendar used was the simplest one: add a day every fourth year. That makes the average year 365.25 days, which is close to 365.2422 but not equal to it. The difference is about 11 minutes a year, which is invisible in a lifetime and very visible over centuries.

Why are 1900 and 2100 not leap years?

Because 365.25 is slightly too long. Over 400 years a "every fourth year" rule inserts 100 leap days, where the Sun wants about 97. The Gregorian rule removes three of them by dropping the leap day from three century years out of four:

YearDivides by 4?Divides by 100?Divides by 400?Leap year?
2024yesnon/ayes
2026non/an/ano
1900yesyesnono
2000yesyesyesyes
2100yesyesnono

Count it out: in every 400 years there are 97 leap years and 303 ordinary ones, which is 146,097 days. Divide by 400 and the average year is 365.2425 days. That is within about 0.0003 of a day of the tropical year, an error that adds up to a day only after several thousand years. Nobody has had to decide what to do about that yet, and as of 2026 nobody has agreed on anything.

Read the rule in the order the exceptions nest. Test 400 first, then 100, then 4. Testing 4 first is the classic mistake: it calls 1900 a leap year.

What did the 1582 reform actually skip?

Before the Gregorian rule, the Julian calendar ran every fourth year with no exceptions, and by the sixteenth century it had drifted about ten days from the seasons. The spring equinox that the church calendar placed near 21 March was arriving around 11 March. Pope Gregory XIII's reform had two parts: adopt the new century rule going forward, and delete ten days to pull the calendar back into line.

In the countries that adopted it first, including Spain, Portugal and most of Italy, Thursday 4 October 1582 was followed by Friday 15 October 1582. No weekday was skipped; the dates were. Adoption was slow and political. Britain and its colonies switched in September 1752 and had to delete eleven days, because another century had passed: 2 September was followed by 14 September. Russia switched in 1918.

The practical consequence is that a date before the switch means different things in different places, and most software ignores that. It extends today's rule backwards forever, which is called the proleptic Gregorian calendar. For anything in modern life that is fine. For a historian comparing two documents from 1600, it is not.

What goes wrong in software on 29 February?

Almost every leap-day bug comes from one of three assumptions.

Some of these have made the news. A music player firmware that hung on the 366th day of 2008, and a cloud platform whose certificates failed on 29 February 2012 because they were issued with a one-year validity counted from a leap day, are the two most often cited. Both have been widely reported, but treat the details as reported accounts and not as something verified here. The pattern is what matters: the bug sits quiet for up to four years.

A neighbour of the same problem is that leap years also break "how long is a day". Days are not always 24 hours when clocks change, which is a separate issue covered in why a timezone is not an offset. Unix time sidesteps both by counting seconds, as what a Unix timestamp is explains.

How do you check a date span across a leap day?

Do not reason from 365. Put the two dates into a date difference calculator and read the total day count: 1 March 2023 to 1 March 2024 is 366 days, and 1 March 2024 to 1 March 2025 is 365. The span that contains 29 February 2024 is the long one. The tool measures against the real calendar, including the century rule, so 28 February to 1 March 2100 is 1 day and the same pair in 2096 is 2.

The age side of it is a convention, not arithmetic. Someone born on 29 February has a real birthday only in leap years, so a calculator of exact age has to pick a day for the other three. Ours treats 28 February as the anniversary. Plenty of others use 1 March, and the legal rule where you live may differ from both. How to calculate your exact age walks through why calculators disagree.

What both tools do not do: they do not know about the days deleted in 1582, 1752 or 1918, because they use the proleptic Gregorian calendar. A span that crosses the British switch will come out eleven days shorter in history than on screen. Do not use them to date documents from before the local adoption. Leap seconds are a different thing again and are not counted by either tool.

Is there any pattern to remember?

  1. If the year divides by 400, it is a leap year.
  2. Otherwise, if it divides by 100, it is not.
  3. Otherwise, if it divides by 4, it is.
  4. Otherwise it is not.

For the current century that collapses to "divides by 4", because 2100 is the only exception and it is 74 years away as of this post. The next three to know: 2028, 2032 and 2036 are leap years, and 2100 is not.

To check a real span instead of trusting 365, run it through the date difference calculator, which works in your browser and measures against the actual calendar, including 29 February and the century rule. It will not know about calendars before the local switch from Julian to Gregorian, so keep it to modern dates.

For the counting convention that trips people even without a leap day, how to count the days between two dates explains why two correct answers exist for the same pair.

Frequently asked questions

How do you know if a year is a leap year?

A year is a leap year if it divides by 400, or if it divides by 4 but not by 100. So 2000 and 2024 are leap years, while 1900 and 2100 are not. Test the century rule first: checking only for divisibility by 4 gets century years wrong.

Why is 2100 not a leap year?

Because it divides by 100 but not by 400. A leap day every fourth year makes the average year 365.25 days, slightly longer than the solar year of about 365.2422 days. The Gregorian calendar drops the leap day from century years that do not divide by 400, which brings the average to 365.2425 days.

How many days were skipped when the Gregorian calendar started?

Ten days in 1582 in the countries that adopted it first: 4 October was followed by 15 October. Britain and its colonies switched later, in September 1752, and skipped eleven days, from 2 September straight to 14 September. Other countries switched at other dates, so the skipped days depend on where you are.

What happens if I add one year to 29 February?

It depends on the software, because the following year has no 29 February. Some libraries clamp to 28 February, some roll over to 1 March, and some raise an error. Check what yours does and test a leap-day date on purpose, since an ordinary test suite will not include one.

Does a leap year have 366 days, and is February the only month that changes?

Yes on both. A leap year has 366 days, and the extra day is 29 February; every other month keeps its length. Any date from March onwards is one day later in the year than it would be in an ordinary year, which is why day-of-year numbers shift after February.

Last updated September 30, 2026