Home › Everyday Life › Leap Year Calculator
Leap Year Calculator
Applies the Gregorian leap-year rule (divisible by 4, except centuries not divisible by 400) to a year and reports the reason, the number of days in the year and in February, and the next and previous leap years.
When to use
You need to know whether a year has 29 February, why, or when the next leap year occurs.
Do not use when: You need the weekday or ISO week of a specific date (use day-of-week) or day counts between dates (use date-difference).
Formula
is_leap = (year mod 4 = 0 and year mod 100 ≠ 0) or year mod 400 = 0
The Gregorian rule gives a mean year of 365.2425 days. Years before 1582 (or before a country's adoption date) were actually reckoned in the Julian calendar, where every fourth year is leap; this calculator applies the Gregorian rule proleptically.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
year | integer | yes | Year in the (proleptic) Gregorian calendar. Range: ≥ 1, ≤ 9999 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
is_leap | boolean | true when the year has 366 days. | |
reason | string | Which part of the rule decided the result. | |
days_in_year | integer | days | 365 or 366. |
days_in_february | integer | days | 28 or 29. |
next_leap_year | integer | First leap year after the given year. | |
previous_leap_year | integer | Last leap year before the given year (absent for years before 4). |
Example
2024: {"year":2024} → {"is_leap":true,"reason":"Divisible by 4 and not by 100","days_in_year":366,"days_in_february":29,"next_leap_year":2028,"previous_leap_year":2020}
1900 (century year not divisible by 400): {"year":1900} → {"is_leap":false,"reason":"Divisible by 100 but not by 400","days_in_year":365,"days_in_february":28,"next_leap_year":1904,"previous_leap_year":1896}
GET https://tttkmbb.com/api/v1/calculate/leap-year?year=2024
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/leap-year(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/leap-year · Markdown: https://tttkmbb.com/everyday/leap-year.md · JSON definition: https://tttkmbb.com/everyday/leap-year.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="leap-year" - OpenAPI operationId:
classify_leap_year - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- US Naval Observatory – Leap Years (government)
- Leap year (Wikipedia) (reference)
FAQ
Was 2000 a leap year?
Yes: it is divisible by 400. 1900 and 2100 are not leap years because they are divisible by 100 but not by 400.
Why does the rule skip some century years?
A solar year is about 365.2422 days; adding a day every 4 years overshoots, so 3 leap days are dropped every 400 years to keep the calendar aligned with the seasons.
Related calculators
- Day of the Week Calculator — Weekday, day of year and ISO week of a date.
- Age Calculator — Ages for people born on 29 February.