Leap Year Checker

Check whether a year is a leap year and find the nearest ones.

Enter a year and this tells you whether it's a leap year, and why. It shows how many days the year has, how long February is, and the previous and next leap years. The rule has exceptions that catch people out: 1900 wasn't a leap year but 2000 was.

How to use it

  1. Enter a year.
  2. Read the verdict and the reason.
  3. Check the nearby leap years.
  4. Try a century year such as 1900 or 2000 to see the exceptions.

When it helps

  • Checking a date calculation.
  • Teaching the leap year rule.
  • Finding the next 29 February.
  • Writing date logic.

Good to know

  • A year is a leap year if it divides by 4, except century years, unless they also divide by 400.
  • A leap day keeps the calendar in step with the Earth's orbit.
  • Leap years usually come every four years.

The rule and its reason

A solar year is about 365.2422 days long. Adding one day every four years gives an average of 365.25, which is slightly too long, so the Gregorian calendar skips three leap days every 400 years: century years are not leap years unless divisible by 400. That brings the average to 365.2425, close enough for thousands of years.

So 1900 was not a leap year, 2000 was, and 2100 will not be.

Worked example: checking years

2024 divides by 4 and isn't a century year, so it's a leap year. 2100 divides by 100 but not by 400, so it isn't. 2400 divides by 400, so it is. The tool states the reason for each, and lists the previous and next leap years.

Try 1900, 2000, 2023 and 2028 in turn to see all four cases.

Leap days in everyday life

People born on 29 February celebrate on 28 February or 1 March in other years. Some legal systems define which date counts, and software has to handle it. A famous bug is a program that assumes every fourth year is a leap year and breaks in 2100.

Leap-year bugs have caused real outages, including a 2012 cloud service failure on 29 February. When you write date code, use a tested library.

Calendars through history

The Roman calendar had many irregularities until Julius Caesar introduced the Julian calendar in 45 BC with a leap day every four years. It drifted by about 11 minutes a year, so by 1582 the calendar was ten days out of step with the seasons, and Pope Gregory XIII reformed it.

Countries adopted the change at different times: Britain and its colonies only in 1752, Russia in 1918, and Greece in 1923.

Programming tip

In code, the rule is: divisible by 4 and not by 100, or divisible by 400. Test your function on 1900, 2000, 2023 and 2024, which together cover every branch of the rule.

Questions

Is 2028 a leap year?

Yes.

Why wasn't 1900 one?

It divides by 100 but not by 400.