Gregorian rules · 4 · 100 · 400

Check if a year is a leap year

Applies the full Gregorian rule: divisible by 4 except centuries unless divisible by 400. Lists the next ten leap years.

Quick Start

How leap years work

Rule: divisible by 4. Exception: centuries (00). Re-exception: divisible by 400 (like 2000) is still a leap year. So 1900 wasn't, 2000 was.

  1. 01

    Type a year

    Any positive integer.

    Parsing accepts ISO 8601, RFC 3339, RFC 2822, and Unix epoch seconds/milliseconds. The Date constructor handles the rest with browser-engine consistency.

    inputISO 8601RFC 3339epochlive
    year · timestamp2026 · ISO
    2026
    loaded · ISO 8601zone · ready
  2. 02

    Rule check

    ÷4 = candidate. ÷100 = exception. ÷400 = re-exception.

    All math runs in UTC internally to avoid DST landmines; presentation converts back to the user’s zone via Intl.DateTimeFormat.

    ruleUTC mathIntlDST-safelive
    test · options÷4 · live
    2024 ÷ 4 = ✓
    options applied · UTCDST-safe
  3. 03

    Verdict

    Leap years have 366 days; February has 29.

    Output respects the chosen timezone offset (Z vs +05:30) and pads digits per ISO conventions so sorts stay chronological.

    resultoffsetzone-awaresortablepadded
    365 · computed366 · ready
    +1 day
    computed · instantsortable
  4. 04

    Next leap years

    Listed for quick reference.

    Copy writes via the Async Clipboard API; nothing pings a time server — the browser’s clock is the only oracle.

    nextclipboardno oracledeterministicclient-side
    ✓ · copiedready · done
    2028, 2032, 2036…
    shipped · ready to shipsuccess
Pro tips

Time math without DST landmines

Always store UTC

Convert to local for display only. UTC storage avoids DST jumps and timezone drift in databases.

Watch leap seconds

POSIX time doesn’t count leap seconds; some systems do. Don’t use timestamps for sub-second precision across boundaries.

Prefer Temporal eventually

The Date API has many quirks. Temporal is shipping in modern engines and handles zones correctly.

Cron is timezone-tricky

Cron expressions run in the daemon’s local zone unless told otherwise. Pin a TZ explicitly for predictable runs.

ISO 8601 sorts naturally

YYYY-MM-DDTHH:mm:ss sorts correctly as a string. Don’t use US-style MM/DD/YYYY for anything machine-readable.

Beware Y2K38

Signed 32-bit Unix timestamps overflow in 2038. Use 64-bit storage end-to-end for long-lived systems.

Use Cases

When to check leap years

Calendars, scheduling, code.

Date arithmetic

Confirm Feb 29 handling in scheduling code. Math runs in UTC under the hood to dodge DST jumps — local time is only for display. That means scheduling logic and date diffs survive March / November fall-back without the classic off-by-one-hour bug.

DST-safe

Birthdays on Feb 29

Plan once-every-four-years parties. Browser clock is the only source — no external time server, no privacy leak, no rate limit. Pair with NTP-synced server time for high-accuracy use cases, but for human-scale work the browser clock is plenty.

UTC-correct

Calendar printing

Year-at-a-glance calendars need the right Feb length. ISO 8601 output sorts naturally as strings, perfect for filenames (report-2026-01-15.pdf) and log lines that need chronological ordering without parsing. Drop into S3 keys for free time-bucketing.

ISO-sortable

Test fixtures

Verify leap-year edge cases in unit tests. Pairs cleanly with cron, scheduled tasks, and timestamped log analysis. The tool's output drops directly into APScheduler, Linux cron, or GitHub Actions schedule expressions without re-formatting.

spec-grade

Subscription periods

Yearly subscriptions on Feb 29 — what happens next year? Output respects the chosen timezone offset (Z vs +05:30) so REST APIs and database TIMESTAMP WITH TIME ZONE columns round-trip cleanly. No ambiguity between "noon UTC" and "noon local".

zone-aware

History

Find historical leap years (rule started 1582). Confirms the difference between epoch seconds (10 digits) and milliseconds (13 digits) before you commit code that mis-multiplies by 1000 — a classic bug in cross-language time handling.

epoch-accurate
FAQ

Frequently asked questions

The pure 4-year rule overcorrects. The 100/400 exception keeps the calendar aligned with Earth's actual orbit.
No — divisible by 100 but not 400, so it skipped.
Yes — divisible by 400, the re-exception.
The Gregorian rule applies from 1582. Earlier Julian-calendar dates use only the ÷4 rule.
No. All runs in your browser.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!