Check if a year is a leap year
The year 2024 is a leap year because it splits evenly by 4 but not by 100. Enter any positive year to get a yes or no plus the three checks behind it, including the century rule that makes 2000 a leap year and 1900 not. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
A leap year adds February 29 so the calendar stays aligned with Earth’s journey around the Sun. This checker accepts a positive integer year and applies the complete Gregorian rule, including the century exception that quick divide-by-four tests often miss. It returns a direct true-or-false result along with the year’s divisibility by 4, 100, and 400, making the decision easy to inspect, explain, test, or use in another application. The same deterministic calculation always gives the same answer.
Enter a valid calendar year
Provide the year as a positive integer, such as 2024, 1900, or 2000. A zero, negative value, fraction, numeric string, missing value, or number beyond JavaScript’s safe integer range is rejected instead of being silently changed. Strict input matters because a calendar year is a discrete value, and automatic rounding or text conversion could make a program answer a different question from the one you intended.
The result repeats the accepted year so an automated caller can associate the response with its request. For an ordinary modern date, enter the familiar four-digit year. The checker also supports earlier or much later positive years by extending the Gregorian arithmetic rule consistently.
It does not inspect a date, infer a year from prose, or convert between historical calendar systems. If your source begins as text, parse and validate it in your application before sending it. This keeps failures visible and makes integration behavior predictable across browser forms, scripts, spreadsheets, and backend services.
Understand the Gregorian rule
Most years divisible by 4 are leap years, but that shortcut is incomplete. Gregorian calendar rules remove the extra day from century years divisible by 100, then restore it when the century year is also divisible by 400. Therefore 2024 is a leap year, 1900 is not, and 2000 is.
The calculation can be stated precisely: a year is a leap year when it is divisible by 400, or when it is divisible by 4 but not by 100. No locale, time zone, current clock, or external calendar service influences the calculation.
What you can do with it
Validate February dates
Check whether February 29 can occur in a supplied year before accepting or constructing a full date.
Explain century-year behavior
Show the 4, 100, and 400 divisibility results when teaching or auditing why 1900 and 2000 differ.
FAQ
What makes a Gregorian year a leap year?
It must be divisible by 400, or divisible by 4 without also being divisible by 100.
Why was 2000 a leap year but 1900 was not?
Both are century years, but 2000 is divisible by 400 while 1900 is not.
Can I submit a year as text?
Numeric strings are rejected so the input contract remains unambiguous.
Does it depend on my time zone or the current date?
No. It performs a deterministic integer calculation and does not read a clock, locale, or time zone.
Does it work for years before the Gregorian calendar was adopted?
It applies the modern Gregorian rule consistently to any positive year, even before a given country adopted that calendar. It does not convert dates from older calendar systems, so check historical records separately.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/calc2/leap-year-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"year":2024}'const res = await fetch("https://api.kit.forhosting.com/calc2/leap-year-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"year": 2024
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/calc2/leap-year-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"year": 2024
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/calc2/leap-year-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"year":2024}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"year":2024}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/calc2/leap-year-check", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"year": 2024
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "calc2.leap_year_check",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Understand the Gregorian rule
The response exposes all three divisibility checks alongside the final Boolean answer. Those fields are useful when teaching the rule, diagnosing an unexpected result, or recording why a scheduling decision was made. It uses integer remainder operations only, so repeated requests with the same year produce identical JSON. This is the proleptic Gregorian arithmetic rule; it applies the modern rule consistently even to years before a particular country historically adopted that calendar.
Use the result safely in applications
A true value means the Gregorian year contains 366 days and February has 29 days; false means it contains 365 days and February has 28. Because the algorithm has no network calls, random choices, stored state, or dependency on the current date, it is suitable for reproducible tests and high-volume pipelines where the same input must always lead to the same result. Read the is_leap_year field for the decision and treat the additional divisibility fields as an explanation. In automated workflows, handle invalid_input as a validation failure and ask the source to supply a positive integer rather than retrying unchanged data. Browser use is convenient for individual checks, while API requests cost $0.002 each when you need repeatable integration.
Integration use cases
Build calendar test fixtures
Generate explicit leap and common year cases for date handling, billing, reporting, and scheduling tests.
Technical questions
Can the year be zero or negative?
No. The capability requires a positive integer and returns invalid_input for zero or negative values.
What does an API check cost?
Each API request costs $0.002. The calculation is also available through the browser experience.