Leap year calculator
The Gregorian rule — every four years, except centuries, except every four hundred years — gives a mean year of 365.2425 days.
Leap years in the range
25
- The year you checked is a leap year
- 0
- Years in the range
- 101
- Days in the range
- 36 890
- Mean year length
- 365.247 525 days
- Calendar drift against the tropical year
- 0:45:05
Show the working
- From year = 2000
- To year = 2100
- Year to check = 2100
- div4 = floor(2100/4) - floor((2000 - 1)/4) = 26
- div100 = floor(2100/100) - floor((2000 - 1)/100) = 2
- div400 = floor(2100/400) - floor((2000 - 1)/400) = 1
- Leap years in the range = 26 - 2 + 1 = 25
- Years in the range = 2100 - 2000 + 1 = 101
- The year you checked is a leap year = (mod(2100,4) == 0 && mod(2100,100) != 0) || mod(2100,400) == 0 ? 1 : 0 = 0
- Days in the range = 101 * 365 + 25 = 36 890
- Mean year length = 101 > 0 ? 36 890 / 101 : 0 = 365.248
- Calendar drift against the tropical year = (365.2425 - 365.242190) * 101 * 86400 = 2705.18
Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.
Scenarios & local history
Compare a saved scenario
Recent calculations
The formula
- a year is a leap year if divisible by 4, except centuries, unless divisible by 400
- that gives 97 leap years per 400, a mean year of 365.2425 days
The tropical year is 365.242190 days, so the Gregorian calendar gains about one day every 3200 years.
1900 was not a leap year and 2000 was, which is the rule that trips up spreadsheets and old software.