ThisCalculator

Everyday

Leap Year Formula: How to Check Any Year

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Leap Year Formula: How to Check Any Year

The leap year formula checks whether a year in the Gregorian calendar has 366 days instead of 365. Enter a year to find out whether it is a leap year, using the calendar’s century-year exception as well as its four-year rule.

Formula

A Gregorian-calendar year is a leap year if it is divisible by 4, except that a year divisible by 100 is not a leap year unless it is also divisible by 400. In symbols:

Leap year if: (year divisible by 4 and not divisible by 100) or (year divisible by 400).

The calculator expresses the result as 1 for yes and 0 for no. Its single input is y, the calendar year, entered as a whole number. Divisibility means that division leaves no remainder. The formula compares each quotient with its rounded-down whole-number value to test that condition; the combined tests implement the century exception. The result is a yes-or-no indicator, not a count of leap days.

Worked Example

Using the default year, 2024:

  1. 2024 ÷ 4 = 506 exactly, so the year is divisible by 4.
  2. 2024 ÷ 100 = 20.24, so it is not divisible by 100.
  3. Because it passes the four-year test and is not a century year, it qualifies.

The formula returns 1, meaning 2024 is a leap year. The year has 366 days, including February 29.

Why Leap Years Exist

Earth takes about 365.2422 days to complete one orbit around the Sun, while a common calendar year has 365 days. If the calendar used only 365-day years, its dates would gradually drift away from the seasons. Adding an extra day every so often helps keep the calendar year aligned with the solar year.

Adding a day every four years would make the average calendar year 365.25 days, slightly longer than the seasonal cycle. That small difference would also accumulate over time. The Gregorian rule omits leap days in most years divisible by 100, then restores them in years divisible by 400. Across a 400-year cycle, this gives 97 leap years and an average year length of 365.2425 days.

The Gregorian calendar was introduced in 1582 as a reform of the Julian calendar. The Julian system used the simpler rule that every year divisible by 4 was a leap year. The Gregorian century exception makes its long-term average more closely match the length of the solar year. Adoption took place at different times in different countries, so historical date calculations may depend on which calendar a place used at the time.

How the Rule Works in Practice

Apply the tests in order, stopping when a result settles the question:

  • If a year is not divisible by 4, it is a common year. For example, 2023 is not a leap year.
  • If it is divisible by 4 but not by 100, it is a leap year. For example, 2024 qualifies.
  • If it is divisible by 100, it is not a leap year unless it is also divisible by 400. For example, 1900 was not a leap year, but 2000 was.

A useful mental check is to look at the last two digits for the first test: a year ending in 00 is divisible by 4, but it still needs the century check. For other years, divisibility by 4 can be checked by seeing whether the number formed by the last two digits is divisible by 4. This shortcut works for ordinary modern year numbers; the complete rule remains the reliable test.

What a Leap Year Changes

A leap year has 366 days, with February 29 inserted after February 28. It does not add a day to every month, nor does it make the year exactly match Earth’s orbital period. The extra day is a calendar adjustment that reduces seasonal drift over long periods.

For date calculations, account for February 29 whenever the interval crosses that date in a leap year. A leap year does not necessarily mean a particular date-to-date interval is one day longer: the answer depends on the start and end dates and on how the interval is counted. For example, “days between” two dates commonly excludes the starting date, while counting both endpoints produces a different total.

Common Mistakes and Limits

  • Using only the divisible-by-4 rule: This incorrectly treats 1900 and other non-400 century years as leap years.
  • Assuming every century year is common: Years such as 2000 are leap years because they are divisible by 400.
  • Confusing a leap year with a leap second: A leap day is part of the calendar; a leap second is a separate timekeeping adjustment.
  • Mixing calendar systems: The formula above is for the Gregorian calendar. The Julian calendar uses a different rule, and historical records may require checking the calendar in force for a particular place and date.

The calculator accepts a year as a whole number and evaluates the Gregorian rule mathematically. For historical dates, that result alone cannot establish which calendar a society used, or how dates were recorded during a transition between systems. For dates before the Gregorian reform, choose the relevant calendar convention before interpreting the result.

Frequently Asked Questions

What is the simple formula for a leap year?
A year is a leap year if it is divisible by 4, unless it is divisible by 100; century years are leap years only when divisible by 400.

Is 2024 a leap year?
Yes. 2024 is divisible by 4 and not by 100, so it has February 29.

Why was 1900 not a leap year?
Although 1900 is divisible by 4, it is also divisible by 100 and not by 400. Under the Gregorian rule, it was a common year.

Was the year 2000 a leap year?
Yes. It is divisible by 400, so it was a leap year despite being a century year.

How many leap years are there in 400 years?
There are 97 in a complete Gregorian 400-year cycle: 100 years divisible by 4, minus three century years that are not divisible by 400.

Does every calendar use this leap year formula?
No. The rule applies to the Gregorian calendar. Other calendar systems can use different rules for adjusting their year lengths.

Related

Formula used
in y | Year | - | 2024 | 0
out leap | Leap year (1=yes, 0=no) | - | (y / 4 = floor(y / 4)) * ((y / 100 != floor(y / 100)) + (y / 400 = floor(y / 400))) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.