A year is a leap year under the Gregorian calendar when it satisfies the rule "divisible by 4, except century years that are not divisible by 400," and it then has 366 days with February running to 29 days instead of the usual 365 days and 28. The full rule has three parts you can test in order, and each part is pure arithmetic. First, if a year is not divisible by 4 it is a common year of 365 days, which rules out 2023, 2025, 2027, and similar years. Second, if a year is divisible by 4 but is not a century year, it is a leap year of 366 days, which makes 2024 and 2028 leap years. Third, century years, those ending in 00, need a stricter check: a year ending in 00 is a leap year only when it is also divisible by 400. That last test is exactly why 2000 was a leap year while 1900 and 2100 were not, a distinction that ordinary "divisible by 4" shortcuts will quietly get wrong.

how to calculate leap year in maths
how to calculate leap year in maths

The Three-Part Rule for Leap Years in Maths

The Gregorian calendar refines a single rule into three nested checks so the average year length tracks Earth's orbit, which takes about 365.2422 days. Writing the rule as arithmetic makes each part easy to test by hand:

  • If year ÷ 4 leaves a remainder, the year is not a leap year (365 days, February has 28 days).
  • If year ÷ 4 leaves no remainder AND the year does not end in 00, the year is a leap year (366 days, February has 29 days).
  • If the year ends in 00 (a century year), check year ÷ 400. If there is no remainder, the year is a leap year; otherwise it is a common year.

In compact form, a year Y is a leap year when:

Y mod 4 = 0 AND (Y mod 100 ≠ 0 OR Y mod 400 = 0)

That single line encodes all three parts, and it is the formula a maths teacher or textbook expects when they ask you to "calculate whether a year is a leap year." The mod operator gives the remainder after division, so each piece is something you can check with a calculator or in your head for small numbers. The "century exception" exists because one leap day every four years over-corrects the calendar slightly; skipping most century years brings the long-run average back to Earth's actual orbital period.

Why "Divisible by 4" Alone Gets the Answer Wrong

A common shortcut taught early is "if the year divides by 4, it is a leap year." That shortcut is correct most of the time but fails at every century year that does not also divide by 400. The skipped years include 1900, 2100, 2200, 2300, 2500, and so on. The table below applies the three-part rule to a handful of years so you can see exactly where the shortcut breaks.

Year ÷ 4 remainder ÷ 100 remainder ÷ 400 remainder Leap year?
20233No
2024024Yes
190000300No
2000000Yes
210000100No
2400000Yes

Reading the table row by row: 2023 fails part 1 outright; 2024 passes part 1 and is not a century year, so it is a leap year; 1900 passes part 1 but fails part 3 because 1900 ÷ 400 leaves 300, so it is not a leap year; 2000 passes every part and is a leap year; 2100 looks just like 1900 and is also not a leap year; 2400 passes part 3 once again and is a leap year. If you only tested divisibility by 4, you would call 1900 and 2100 leap years and end up off by a full day.

Worked Example: Testing the Year 1900

Let's walk through one year so the arithmetic is visible. Pick 1900.

  • Step 1: 1900 ÷ 4 = 475 with remainder 0, so 1900 is divisible by 4. The first part of the rule is satisfied, but 1900 ends in 00, so we are not done.
  • Step 2: 1900 ÷ 100 = 19 with remainder 0, which confirms 1900 is a century year. The century-year branch of the rule applies.
  • Step 3: 1900 ÷ 400 = 4 with remainder 300. Because the remainder is not zero, 1900 is not divisible by 400, so the rule returns false.

Conclusion: 1900 is a common year. It has 365 days and February 1900 has 28 days, even though 1900 is divisible by 4. Compare that with 2000, where the only change is the last step: 2000 ÷ 400 = 5 with remainder 0, so 2000 passes every part and is a leap year with 366 days and a 29-day February. The same arithmetic pattern runs through every century year you will ever check.

How Many Leap Years Fit in a Century or 400 Years

The three-part rule produces a clean long-term pattern that matches Earth's orbit. Out of any 400 consecutive years, exactly 97 are leap years and 303 are common years. You can derive that number with simple arithmetic:

  • Step 1: 400 ÷ 4 = 100, so a naive count gives 100 candidate leap years.
  • Step 2: 400 ÷ 100 = 4, so there are 4 century years in the block (the years ending in 00).
  • Step 3: 400 ÷ 400 = 1, so only 1 of those century years is divisible by 400 and stays a leap year.
  • Step 4: 100 − (4 − 1) = 100 − 3 = 97 leap years.

That arithmetic is the whole reason the rule looks the way it does. The "skip 3 out of 4 century years" part is the correction that removes the slight over-counting you would get if you added a day every four years with no exception. The resulting 400-year average year length is 365.2425 days, very close to the actual orbital period of about 365.2422 days, which is why the Gregorian calendar stays aligned with the seasons over long stretches. For shorter ranges the count varies. A century like 2001 to 2100 contains 24 leap years, because the century year 2100 is skipped. A century like 1901 to 2000 contains 25 leap years, because the century year 2000 is not skipped.

Maths Problems That Need the Leap Year Rule

The rule shows up in a handful of recurring maths problems, and recognising which branch of the rule to apply saves time.

Counting leap years between two years. A common question is "how many leap years are between year A and year B inclusive?" The trick is to count multiples of 4 in the range, then subtract the century years that are not multiples of 400. You can also lean on the fact that every 400-year block holds 97 leap years, which shortens the calculation when the range crosses a 400-year boundary.

Calculating exact days between two dates. If a range crosses a February 29, the day count has to include that extra day. For a clean maths answer, write the range as full years, then leap years, then leftover days, and add the leap days back in by counting the leap years on either side of the range.

Finding the day of the year for February 29. February 29 sits at day 60 of a leap year, while February 28 sits at day 59 in a common year. Many maths problems ask for the day number to test whether you remembered the extra day. For a related walkthrough of that calculation, see the guide on how to calculate the day number of any year.

Age and birthday arithmetic. Anyone born on February 29 technically celebrates a "leap-year birthday" only every four years in civil terms, although their actual age in years advances normally. The maths problem usually asks how many times the person has celebrated their leap-year birthday by a given date, which is the count of leap years on or after their birth year and before or on the target year.

Orbital and seasonal alignment. The deeper maths question, why we need the rule at all, comes from the orbital period. Earth's orbit of about 365.2422 days is the same kind of arithmetic problem the rule is solving: how do you approximate a non-integer day count with a calendar that uses whole-number years.

Verify Any Year in Seconds with the Leap Year Calculator

Once you know the rule, the fastest way to check a year is to let a tool apply the same three-part arithmetic for you. The Leap Year Calculator runs the rule in your browser and shows the result, the reasoning, and the surrounding leap years. Here is exactly how to use it:

  1. Type any year into the field — it defaults to the current year, so you see an answer right away.
  2. Read whether it is a leap year, along with the rule that decides it and the number of days that year has.
  3. Check the previous and next leap years, plus the leap years listed nearby below the result.

The tool also works for any whole-number year, including 0 and negative years under the proleptic Gregorian calendar (astronomical year numbering, where year 0 is 1 BC), because the divisibility rule holds for every integer. Everything runs in your browser, so no year you type is uploaded and there is no signup or limit on how many years you check. If you then need to count the exact days between two dates, use a Date Difference Calculator; to find what day number of the year a date falls on, use a Day of Year Calculator; and to work out an age across leap years, use an Age Calculator.