Glossary Data & Encoding

Leap year

A leap year has 366 days, with 29 February added, to keep the calendar aligned with the Earth's orbit.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page

In more detail

A year is a leap year if divisible by 4, except century years, unless divisible by 400: 2024 and 2000 are leap years, 1900 and 2100 are not. That gives 97 leap years every 400 years and an average Gregorian year of 365.2425 days, very close to the solar year of about 365.2422 days, so the calendar drifts only about one day in 3,200 years. The next leap years are 2028, 2032 and 2036. See How Dates and Time Zones Work.

Why it matters

Date arithmetic that ignores leap years is wrong by a day after February: counting days, ages, loan interest or "one year later" all depend on it. Adding a year to 29 February has no single right answer, and libraries differ between 28 February and 1 March. Spreadsheets inherited a famous error: Excel treats 1900 as a leap year for compatibility with Lotus 1-2-3, although it was not.

Example

From 28 February to 1 March is 2 days in 2024 but 1 day in 2026. In Python:

>>> import calendar
>>> [calendar.isleap(y) for y in (1900, 2000, 2024, 2026, 2100)]
[False, True, True, False, False]
AdSense Placeholder
Slot: footer_leaderboard