Leap Year
Use the Leap Year Calculator → Try the Leap Year Quiz →What is Leap Year?
A leap year is a calendar year containing 366 days instead of the standard 365. The extra day is added as February 29 - "leap day." This correction keeps the Gregorian calendar synchronized with Earth's orbit around the Sun. The astronomical year (one complete Earth orbit) is approximately 365.2422 days. Without the correction, the calendar would drift by roughly 24 days per century.
The Gregorian rule for determining leap years has three conditions applied in order: a year divisible by 4 is a leap year; however, century years (1700, 1800, 1900) are not leap years even though divisible by 4; except that century years divisible by 400 are leap years (2000 was a leap year, 1900 was not). This three-part rule reduces the remaining calendar error to about 26 seconds per year - accurate enough that no further correction will be needed for several thousand years.
The name "leap year" refers to the way fixed calendar dates behave. In an ordinary year, any date falls one weekday later than the same date the previous year. In a leap year, dates after February 29 "leap" an extra day - falling two weekdays later than the previous year instead of one. This is why a birthday falling on Tuesday in 2023 would fall on Thursday in 2024 (a leap year) rather than Wednesday.
Leap Year explained to a beginner
Think of it like this: Earth takes about 365 and a quarter days to orbit the Sun, but the calendar only has whole days. So we count 365 days per year and bank the leftover quarter-day. After four years, we've saved up four quarters - one full day. We spend that saved day on February 29.
Without this correction, the calendar would drift. Midsummer holidays would slowly slide into autumn over centuries, and the seasons would no longer line up with the months people expect. The three-part Gregorian rule (divisible by 4, except centuries, except centuries divisible by 400) fine-tunes the correction so the drift is down to 26 seconds per year instead of 11 minutes.
When to use Leap Year
Relevant whenever you calculate durations spanning February of a potential leap year. Any range that crosses February 29 is exactly 1 day longer than the same range in a non-leap year. Age calculators, date difference calculators, recurring billing systems, and contract duration tools all need to apply the full three-part Gregorian rule - not just the simple "divisible by 4" check.
Worked examples for Leap Year
This table quickly gives you the overview you need to understand Leap Year and its most important comparisons.
| Year | Divisible by 4? | Divisible by 100? | Divisible by 400? | Leap year? |
|---|---|---|---|---|
| 2024 | Yes | No | - | Yes |
| 2023 | No | - | - | No |
| 2000 | Yes | Yes | Yes | Yes |
| 1900 | Yes | Yes | No | No |
| 2100 | Yes | Yes | No | No |
| 2400 | Yes | Yes | Yes | Yes |
Common pitfalls
The most common programming error is using only year % 4 === 0 and forgetting the century exception. This incorrectly classifies 1900, 2100, 2200, and 2300 as leap years. The correct logic is: (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0. A secondary issue: people born on February 29 have no legal birthday in non-leap years. The UK, New Zealand, and Hong Kong use March 1 as the legal date for age-of-majority calculations; many other jurisdictions use February 28. Always verify the specific rule when leap-day birthdays affect legal age thresholds.
Frequently asked questions about Leap Year
Why is 2000 a leap year but 1900 is not?
Both are divisible by 4, but century years only qualify as leap years if also divisible by 400. 2000 divided by 400 is exactly 5, so 2000 qualifies. 1900 divided by 400 is 4.75, so 1900 does not. The same rule excludes 2100, 2200, and 2300 from being leap years.
How does a leap year affect date range calculations?
Any date range that spans February 29 is exactly 1 day longer than the same range in a non-leap year. For example, January 1 to March 1 is 59 days in 2023 and 60 days in 2024. Ranges that begin and end entirely before March 1, or entirely after February, are unaffected by whether the year is a leap year.
What is the correct code to check for a leap year?
The full three-part Gregorian rule: (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0. The simple year % 4 === 0 check misclassifies century years like 1900 and 2100 as leap years. Most standard date libraries apply this correctly, but custom implementations should always test against 1900 (not a leap year) and 2000 (a leap year).
How many days are in a 4-year period?
Exactly 1,461 days: three ordinary years of 365 days (1,095) plus one leap year of 366 days. This 1,461-day block is the fundamental unit underlying the Gregorian calendar's correction. A 400-year Gregorian cycle contains exactly 97 leap years and 146,097 days.
What happens to February 29 birthdays in non-leap years?
Legal practice varies by jurisdiction. The UK, New Zealand, and Hong Kong treat March 1 as the legal birthday for purposes such as driving licenses and the age of majority in non-leap years. Many other countries use February 28. People born on February 29 often celebrate on either date depending on personal preference and local custom.
Quiz: how well do you know leap years?
1. Which of the following years is NOT a leap year according to the Gregorian rule?
2. What is the correct programming condition to determine whether a year is a leap year?
3. By how many days is January 1 to March 1 longer in a leap year than in a non-leap year?
4. How many leap years are there in a complete 400-year Gregorian cycle?
5. What calendar drift does the Gregorian rule reduce the annual error to, compared to the Julian calendar's 11 minutes per year?