Time & Calendar
Basic

Leap Year Rule

Tests whether a Gregorian year has 366 days.

Formula

leap  ⟺  (y mod 4=0  ∧  y mod 100≠0)  ∨  (y mod 400=0)\text{leap} \iff (y \bmod 4 = 0 \;\wedge\; y \bmod 100 \neq 0) \;\vee\; (y \bmod 400 = 0)

Variables

yYear

Example

2000 is a leap year (÷400); 1900 is not (÷100 but not ÷400)

How it works

The Gregorian calendar adds an extra day to February in most years divisible by 4 so the calendar stays aligned with Earth’s orbit around the Sun, which is about 365.2422 days long. However, years divisible by 100 are skipped because adding too many leap days would make the calendar drift too far; years divisible by 400 are added back in to correct that adjustment. This rule gives 97 leap years in every 400-year cycle, which matches the solar year very closely.

When to use it

Use this rule when checking whether a specific Gregorian year has 365 or 366 days. It is common in date calculations, calendar programming, scheduling, age/time problems, and any question involving February 29.

Worked example, step by step

Check whether 2024 is a leap year. 2024 mod 4 = 0, so it passes the first test. 2024 mod 100 = 24, so it is not divisible by 100. Since it is divisible by 4 and not by 100, 2024 is a leap year. Final answer: 2024 has 366 days.

Common mistakes to avoid

  • Thinking every year divisible by 4 is a leap year, including century years like 2100
  • Forgetting the special exception for years divisible by 400
  • Using the rule for the Julian calendar instead of the Gregorian calendar

Did You Know?

The extra 400-year rule keeps the calendar aligned with the solar year to within one day for about 3,300 years.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026