A developer hardcodes February as 28 days, deploys on January 30, and watches the app crash on March 1 of a leap year because the date picker skipped February 29 entirely. A payroll clerk counts “one month from January 31” and lands on March 3 instead of February 28. Both mistakes trace back to the same blind spot: months are not all the same length, and February changes size every four years — except when it does not. A leap year calculator that also shows month lengths and flags calendar edge cases saves you from the kind of off-by-one bug that only shows up once every 1,461 days.
Enter any year to check whether it is a leap year, see month-by-month day counts, and spot the edge cases that trip up date logic in spreadsheets and code.
The Three-Rule Test That Decides Leap Years
The Gregorian rule is a chain of three checks, applied in order:
- Divisible by 4? If no, it is a common year (365 days). Example: 2023 is not divisible by 4 → common year.
- Divisible by 100? If yes and not by 400, still a common year. Example: 1900 is divisible by 100 but not by 400 → common year (no February 29).
- Divisible by 400? If yes, it is a leap year. Example: 2000 passes all three checks → leap year.
Most people remember only the first rule. The century exception (rule 2) and its override (rule 3) trip up quiz answers, spreadsheet formulas, and firmware that assumed 2100 would be a leap year. It will not be.
Month Lengths and the Traps They Set
Seven months have 31 days, four have 30, and February has 28 or 29. That irregularity creates two recurring problems:
- “One month from January 31” cannot land on February 31 because the date does not exist. Most date libraries roll it forward to March 3 (or March 2 in a leap year), silently producing a span that is 31 days — not one calendar month. If a contract says “one month,” confirm whether it means “the same date next month” or “the last day of the next month.”
- February 29 birthdays. People born on leap day do not have a birthday in common years. Some systems treat March 1 as the anniversary; others use February 28. The choice matters for age-gating, insurance renewals, and any rule that fires on an exact date.
The calculator lists every month’s day count for the entered year so you can eyeball these edge cases without looking them up.
Quick Checks That Catch Common Calendar Bugs
- If your date validation rejects February 29 in a leap year, the leap-year check is missing or wrong.
- If “add one month” from January 31 returns March 3, the library is adding 31 days, not one calendar month.
- If a yearly loop counts 365 days every year, totals will drift by one day per leap year. Over a decade that is two or three days off.
- If year-end reports assume December always follows a 365-day year, any leap-year row will be off by one in cumulative columns.
Related tools: Days Between Dates Calculator for spans that cross leap-year boundaries, Age Calculator for leap-day birthday breakdowns, How Long Since / Until for elapsed time with months and days, and Business Days Calculator for working-day counts that handle February correctly.
Calculations follow the Gregorian calendar. Pre-Gregorian dates (before October 1582 in most countries) used different leap-year rules and are not covered here.