Article — Leap Year Calculator
Leap Year Calculator
A leap year is any year with 366 days instead of the usual 365. Under the Gregorian calendar in use since 1582, a year is a leap year if it is divisible by 4, except century years are not leap years, except century years divisible by 400 are leap years. So 2024 yes, 1900 no, 2000 yes.
The rule lives in three short steps. The first two cover the common case, where every fourth year gets an extra day. The third pulls the calendar back in line every 400 years, smoothing out a tiny excess that would otherwise drift the seasons. Most people remember the four-year part. The 100 and 400 parts trip up even careful spreadsheet authors.
What is a leap year?
A leap year has 366 days. The extra day is February 29, sometimes called leap day. A common year has 365 days, with February ending on the 28th. The calendar adds a leap day so the average length of the year stays close to one full orbit of Earth around the Sun, which takes about 365.2422 days.
The current leap year rule comes from the Gregorian calendar, introduced by Pope Gregory XIII in October 1582. It replaced the Julian calendar, which had been in use since 45 BC. The Gregorian rule keeps the calendar accurate to within a single day every 3,236 years, which is good enough that astronomers and timekeepers have not needed to revise it.
The Gregorian calendar reform skipped 10 days in 1582 to correct accumulated Julian drift. In Catholic countries, October 4 was followed directly by October 15. Protestant countries held out for centuries — Britain and its colonies waited until 1752, when they skipped 11 days at once. The American records of George Washington show two birthdays: Feb 11 (Old Style) and Feb 22 (New Style).
The 4 / 100 / 400 leap year rule
The leap year rule is a three-step check. The first answer you find is the final answer.
- Step 1 — if the year is divisible by 400, it is a leap year. Stop.
- Step 2 — if the year is divisible by 100 (but not 400), it is not a leap year. Stop.
- Step 3 — if the year is divisible by 4 (and not 100), it is a leap year. Stop.
- Otherwise — it is a common year with 365 days.
Applied to recent years: 2020 passes step 3 (divisible by 4, not 100). 2024 passes step 3 the same way. 2025 fails all three. 2000 passes step 1 — the rare case where the 400-year override matters. 1900 hits step 2 and ends as a common year, which surprises people who remember the four-year cycle but not the century exception.
2024 leap (4: yes, 100: no)2025 common (4: no)2028 leap (4: yes, 100: no)2100 common (4: yes, 100: yes, 400: no)2400 leap (4: yes, 100: yes, 400: yes)The century year trap
Century years are the part of the rule most people get wrong. The simple cycle of every four years suggests 1700, 1800, and 1900 should all be leap years. They were not. None of them passed step 1 of the rule, because none are divisible by 400.
Year 2000 was the surprise winner of the modern era. It was the first century year in 400 years to pass step 1, having last happened in 1600. The next will be 2400. Most people alive today have never lived through a non-leap century year — 2100 will be the first, and it is still a long way off.
Microsoft Excel and Lotus 1-2-3 both treat 1900 as a leap year for compatibility reasons. The bug came from Lotus and was carried over to maintain serial-date interoperability. If you build date math with Excel's date serial numbers, a date in 1900 may shift by one day compared to a correctly written calendar library.
Why we need leap years at all
The tropical year — one full cycle of seasons — is 365.2422 days. If every calendar year had exactly 365 days, the seasons would drift by a quarter of a day per year, putting them off by 97 days after four centuries.
Julius Caesar tried to fix this in 45 BC with the Julian calendar, which added one leap year every four years. That gives an average of 365.25 days, close but still 11 minutes too long. By 1582, the Julian calendar had drifted 10 days behind the seasons, prompting the Gregorian reform.
Julian vs Gregorian leap years
The Julian rule is simple: any year divisible by 4 is a leap year, with no exceptions. The Gregorian rule adds the 100 and 400 corrections. The two disagree for 3 of every 400 years — the century years not divisible by 400. Astronomers and historians still use the Julian system for ancient dates, and Eastern Orthodox churches use a revised Julian calendar for liturgy.
Famous calendar software bugs
Date handling is a common source of bugs, almost always caused by code that assumes every fourth year is a leap year (or every year ending in 00 is not) without checking the full rule.
In 2008, Microsoft Zune media players froze on December 31 because of a leap-year loop that did not exit on the 366th day. In 2012, Microsoft Azure had a six-hour outage from a certificate calculation that appended February 29 to a non-leap year. In 2024, several Asian transit ticket-printing systems rejected leap-day timestamps for hours.
If you write date code, use a tested library. ICU, java.time,.NET DateOnly, Python's datetime, JavaScript's Temporal, and Go's time package all handle leap years correctly. Hand-rolled mod-4 checks miss the 100 / 400 corrections more often than not.
Leap year cycles, Olympics, and US elections
Summer Olympic years and US presidential election years tend to land on leap years because both follow four-year cycles synchronized to them. Every Summer Olympics from 1896 to 2024 (excluding 1900 and the World War II cancellations) and every US presidential election since 1788 has fallen on a leap year. The cycle will visibly skip at the next non-leap century year, which is 2100.
Leaplings born on February 29
People born on February 29 are sometimes called leaplings or leapers. Their birth dates fall on a real calendar day only once every four years. About 1 in 1,461 people are leaplings — close to 5 million worldwide, and about 226,000 in the United States.
Most jurisdictions treat a leapling's legal birthday as March 1 in common years, since this is the next day that exists. Driving age, voting age, and drinking age all use this rule. New Zealand and Taiwan use February 28 instead. Sweden and Finland recognize February 29 as the legal birthday and simply skip the celebration in common years.
Famous leaplings include rapper Ja Rule (1976), motivational speaker Tony Robbins (1960), and Pope Paul III (1468). The town of Anthony, Texas, calls itself the "Leap Year Capital of the World" and has hosted a Leap Year Festival every leap year since 1988.