Solved.tools โ€” Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Leap Year Calculator

Last updated: 23 August 2026

Reviewed by Gavin ยท Research and drafting assisted by AI

Enter a year to find out whether it is a leap year under the Gregorian rule, which of the three rules fired (divisible by 4, not by 100, or by 400), how many days each month has in that year, the next 10 leap years from that point, and how many leap years fall in any chosen range.

Whole integer between 1 and 9999.
Verdict for year 2024
โœ“ Leap year
2024 is divisible by 4 and not by 100, so the standard rule fires: it is a leap year.
y % 400= 24y % 100= 24y % 4= 0

Days in each month of 2024(total = 366 days)

MonthDaysNote
January31
February29leap day added
March31
April30
May31
June30
July31
August31
September30
October31
November30
December31

Next 10 leap years after 2024

2028(+4 yrs)2032(+8 yrs)2036(+12 yrs)2040(+16 yrs)2044(+20 yrs)2048(+24 yrs)2052(+28 yrs)2056(+32 yrs)2060(+36 yrs)2064(+40 yrs)

Leap years in range [1900, 2000]

25
out of 101 years (24.75%)
Average is ~1 leap year per 4 years, minus 3 every 400 years (~365.2425 days/year).
Was this helpful?


Leap Year Calculator

A leap year is a calendar year that contains one extra day, 29 February, making the year 366 days long instead of the usual 365. The extra day keeps the calendar aligned with the Earth's orbit around the Sun, which takes approximately 365.2422 mean solar days. Without it, the calendar would drift away from the seasons by about one day every four years, so a leap day is added almost every four years to keep months and seasons aligned. The rule that decides when to add it is the same rule that has been used worldwide since the Gregorian reform of 1582.

This Leap Year Calculator applies the standard Gregorian rule to any year you enter. It shows you which of the three rules fired (divisible by 4, not by 100, or by 400), the days in each month of the entered year, the next 10 leap years from your starting point, and the count of leap years in any range of years you choose.

How to Use This Calculator

  1. Enter a year in the first input field. Any whole integer between 1 and 9999 is accepted. The calculator updates the results immediately as you type.
  2. Read the verdict block at the top of the results. It tells you whether the year is a leap year, which of the three rules fired (and why), and shows the actual remainders (y % 400, y % 100, y % 4) so you can verify the arithmetic.
  3. Look at the "Days in each month" table. February is highlighted in green when it has 29 days, so the leap-day effect is immediately visible.
  4. Check the "Next 10 leap years" panel for a list of the next ten leap years after your input. Each entry shows the year and the gap in years from your input.
  5. Enter a range start and range end in the two range fields to count leap years in an arbitrary interval. The interval is inclusive on both ends, so 1900 to 2000 includes both 1900 and 2000.
  6. Optionally copy a plain-text summary of the results to your clipboard using the "Copy summary" button, useful for pasting into a chat, ticket, or document.

The Three Gregorian Rules

The Gregorian calendar encodes a single mathematical rule:

isLeap = (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0

That single line collapses to three rules applied in order from strongest to weakest. Reading them in priority order:

  1. Divisible by 400: the year is always a leap year. This rule is the strongest because it overrides everything below. It rescues century years like 2000, 2400, 2800, and 3200 from the second rule.
  2. Divisible by 100 but NOT by 400: the year is not a leap year. This rule cancels out the simple "divisible by 4" rule for years like 1700, 1800, 1900, 2100, 2200, 2300, and 2500.
  3. Divisible by 4 but NOT by 100: the year is a leap year. This is the simple rule most people remember, and it applies to the vast majority of years.
  4. Otherwise the year is not a leap year.

The astronomical reason for this rule is that one tropical year is about 365.2422 mean solar days. A calendar that adds a day every four years gives an average year length of 365.25 days, an error of about +0.0078 days per year that compounds to roughly one full day every 128 years. By 1582 the error had grown to about 10 days since the Council of Nicaea in 325 CE, which is why Pope Gregory XIII issued the bull Inter gravissimas, skipping 10 calendar days in October 1582 and adopting the /100 and /400 exceptions. The resulting average year length is 365 + 1/4 โˆ’ 1/100 + 1/400 = 365.2425 days, which is within 0.0003 days of the true tropical year, an error of about one day every 3,300 years.

Worked Examples

Walking through the most common test cases confirms the rule. The actual remainders are the cleanest way to see which clause fires.

  • 1900: NOT a leap year. y % 400 = 300, y % 100 = 0, y % 4 = 0. The second rule fires because 1900 is divisible by 100 but not by 400, so the /4 rule is cancelled. Feb 1900 has 28 days, not 29.
  • 2000: IS a leap year. y % 400 = 0, y % 100 = 0, y % 4 = 0. The first rule fires first because 2000 is divisible by 400. Feb 2000 has 29 days.
  • 2024: IS a leap year. y % 400 = 24, y % 100 = 24, y % 4 = 0. The third rule fires because 2024 is divisible by 4 but not by 100. Feb 2024 has 29 days.
  • 2100: NOT a leap year. y % 400 = 100, y % 100 = 0, y % 4 = 0. The second rule fires because 2100 is divisible by 100 but not by 400. Feb 2100 will have 28 days.
  • 1600: IS a leap year. y % 400 = 0. The first rule fires. (1600 is before the Gregorian reform, but as a mathematical extension of the rule, it is a leap year.)

A useful verification range: from 1900 to 2000 inclusive, the number of leap years is exactly 25 (years divisible by 4 in that span, minus 1900 which is cancelled by the /100 rule, plus 2000 which is restored by the /400 rule). The calculator's range counter should reproduce this exactly.

Where Leap-Year Logic Shows Up

Leap-year handling touches a surprisingly wide slice of software and everyday life. Knowing which rule fired is useful in all of these contexts because most of the bugs come from forgetting one of the three clauses.

  • Payroll systems: February has either 28 or 29 pay periods depending on whether the year is a leap year, which affects monthly-salary divides and Feb 29 pay-date validations. Most modern payroll engines test the entered year explicitly with the same rule used here.
  • Contracts and leases: One-year contracts starting on 1 March of a leap year end on 28 February of the next year, not 29 February, unless the end year is itself a leap year. This is a common source of off-by-one bugs in date-arithmetic code.
  • Software date bugs: Y2K (year 2000) was a famous leap-year-related concern because 2000 is itself a leap year (divisible by 400), and a naive "divisible by 4" rule applied to years like 1900, 2100, 2200, or 2300 silently produces a non-existent 29 February 1900. This bug reappears regularly in legacy code that has not been updated to the full Gregorian rule.
  • February 29 birthdays: People born on 29 February only have a "real" birthday every four years. Most jurisdictions treat 28 February or 1 March as the official birthday in non-leap years. UK law treats 1 March as the birthday for legal purposes; many US states use 28 February.
  • Astronomy and ephemerides: Astronomical almanacs publish leap-second announcements that are independent of civil leap years but use the same naming convention. The IERS (International Earth Rotation and Reference Systems Service) tracks Earth's rotation and announces leap seconds when needed.
  • Scheduling and calendars: Recurring events, subscription billing, and recurring bookings must account for February's variable length. A "monthly on the 30th" event starting on 30 January skips February entirely in non-leap years unless explicitly handled.

Common Mistakes to Avoid

Assuming every fourth year is a leap year. 1900, 2100, 2200, and 2300 are divisible by 4 but they are not leap years. Always test the full Gregorian rule, not just y % 4 === 0. The CenturyException is the most commonly missed clause.

Ignoring the 400-year exception. 2000, 2400, and 2800 are divisible by 100 but they are leap years because they are also divisible by 400. A rule that simply says "divisible by 100 is not a leap year" misses these and silently corrupts date arithmetic that crosses 2000, 2400, etc.

Confusing Julian and Gregorian dates before 1582. The Julian calendar, in use across Europe before the 1582 reform, added a leap day every four years with no exception. Countries adopted the Gregorian reform at different times: Italy, Spain, Portugal, and Poland in 1582; most of Catholic Germany in 1583; Britain and its colonies only in 1752; Russia not until 1918. For historical dates before October 1582, "the calendar" is ambiguous and proleptic Gregorian dates may not match the calendar that was actually in use.

Treating proleptic dates as historical. This calculator applies the Gregorian rule to every year from 1 CE onward as a mathematical convenience. For astronomical calculations that span pre-1582 dates, the proleptic Gregorian calendar is well-defined and widely used. For historical events, the date recorded in the source documents may differ by up to 10 days from the proleptic Gregorian conversion.

Julian-vs-Gregorian Caveat (Years Before 1582)

For years before 1582 the Gregorian rule is a proleptic extension of the calendar. In historical reality, Europe used the Julian calendar, which simply added a day every 4 years with no exception. The calculator uses the modern Gregorian rule throughout because that is the convention every modern software library uses, but the visible note in the UI makes this explicit when you enter a year before 1582.

Frequently Asked Questions

How do I know if a year is a leap year? Apply the Gregorian rule: a year is a leap year if it is divisible by 4, except for years divisible by 100, which are leap years only if they are also divisible by 400. Concretely: (y % 4 === 0 && y % 100 !== 0) || y % 400 === 0. The three most memorable edge cases are 1900 (not a leap year), 2000 (a leap year), and 2100 (not a leap year).

Why is 2000 a leap year but 1900 is not? Both are divisible by 100, but only 2000 is divisible by 400. The 400-year rule is the strongest exception in the Gregorian calendar; it rescues century years that would otherwise drift the calendar off the seasons. 2400, 2800, and 3200 are also leap years for the same reason.

How many leap years are there in a century? In any 100-year span that aligns with the Gregorian cycle, there are exactly 24 or 25 leap years. From 1901 to 2000 inclusive there are 24 (because 1900 is excluded). From 2001 to 2100 inclusive there are 24 (because 2100 is excluded). From 1900 to 1999 inclusive there are 24, but from 1900 to 2000 inclusive there are 25 because 2000 is included.

Why does the Gregorian calendar skip 10 days in 1582? By the time of Pope Gregory XIII, the Julian calendar had drifted about 10 days from the astronomical seasons since the Council of Nicaea in 325 CE. The reform skipped the days 5 to 14 October 1582 in Catholic countries (4 October was followed by 15 October) so that the equinox returned to 21 March. Orthodox churches still use the Julian calendar for movable feasts, which is why Orthodox Easter usually falls on a different date than Western Easter.

What year will be the next time we skip a leap day? 2100 will be the next common year that would have been a leap year under the simple "every 4 years" rule. It is divisible by 100 but not by 400, so the century exception applies and February has only 28 days. After 2100, the next such skip is 2200, then 2300, then 2500. Calendar systems and software that look ahead more than a few decades need to handle these correctly.

Were leap years different before 1582? Yes. The Julian calendar, used across the Roman Empire from 45 BCE and across Christian Europe until the Gregorian reform, added a leap day every four years with no century exception. Under that rule, 1700, 1800, and 1900 would all have been leap years, but they are not in the modern Gregorian calendar. This calculator applies the Gregorian rule to all years (a "proleptic" extension), which is the convention used by every modern computer calendar library.

Does the Gregorian calendar ever need a further reform? The Gregorian calendar's average year length is 365.2425 days, which is 0.0003 days per year longer than the true tropical year of about 365.2422 days. The error accumulates to about one day every 3,236 years. The next reform candidate would be to skip one leap year in every 4,000-year cycle: 4000, 8000, 12000, and so on would not be leap years. This was first proposed by John Herschel in the 19th century and is sometimes called the "Revised Julian" or "Herschel" reform. No country has adopted it yet.

Who decides when a leap second is added? The International Earth Rotation and Reference Systems Service (IERS) monitors Earth's rotation and announces a leap second whenever the difference between atomic time (TAI) and Earth-rotation time (UT1) approaches 0.9 seconds. Leap seconds are independent of civil leap years; they are added to either 30 June or 31 December as needed. There have been 27 leap seconds since 1972.

References

  • Gregory XIII, Inter gravissimas, papal bull instituting the Gregorian calendar reform, 24 February 1582. The original bull specified the skip of 10 days in October 1582 and the /100 and /400 century exceptions.
  • USNO (United States Naval Observatory), Astronomical Almanac, "Calendar" chapter. The official source for leap-year rules, Julian Day Number conventions, and the precise length of the tropical year.
  • NIST (National Institute of Standards and Technology), Time and Frequency Division, publications on civil timekeeping, leap-second announcements, and the relationship between UTC and UT1.
  • IERS (International Earth Rotation and Reference Systems Service), IERS Conventions (2010), Tech Note 36, ยง1.2 on the definition of the tropical year and the basis for leap-second decisions.
  • Bureau International des Poids et Mesures (BIPM), SI Brochure, Appendix 2 on the realisation of UTC and the role of leap seconds.
  • Duncan, David Ewing, Calendar: Humanity's Epic Struggle to Determine a True and Accurate Year, Avon Books, 1998. Accessible history of the Gregorian reform and the leap-year rule.