Date Difference Calculator

Calculate the number of days between two dates.

Select two dates to find the difference.

What This Calculator Does

Counting the days between two dates by eyeballing a calendar is easy to get wrong, especially once the span crosses a month with a different length or a leap year. This tool takes two dates and returns the exact number of days separating them — useful for deadlines, countdowns, or just settling "how long ago was that, actually?"

How to Use It

Pick a From Date and a To Date using the two date pickers — both default to today. The result states the day count as a full sentence, phrased in whichever direction makes sense (from the earlier date to the later one), so you don't have to figure out which number is "ahead" yourself. If you enter the same date twice, it tells you plainly that the dates match rather than showing a confusing zero.

The Formula

The calculator uses date-fns's differenceInDays function, which counts the whole calendar days between two dates. Because it works from real calendar data rather than a fixed average, it automatically accounts for the actual length of every month in the span — including February's real length in whichever year it happens to be, 28 days most years and 29 in a leap year — without any extra logic needed on this project's side.

A Worked Example

From 2024-01-01 to 2024-01-31 is 30 days — a plain within-month case. Crossing February shows the leap year effect directly: 2024-02-01 to 2024-03-01 is 29 days, since 2024 is a leap year and February has 29 days that year. Run the same span one year earlier, 2023-02-01 to 2023-03-01, and it's 28 days instead — 2023 isn't a leap year, so that February is a day shorter, and the calculator reflects that difference automatically.

How to Count Days Between Dates Manually

For two dates within the same month, just subtract the day numbers (January 31 minus January 1 is 30 days). Crossing a month boundary means adding up the days remaining in the starting month, plus the full length of any months in between, plus the day number you land on in the final month. The part people most often get wrong by hand is February's length: it's 28 days in most years, but 29 in a leap year — a year divisible by 4, except century years (like 1900) unless they're also divisible by 400 (like 2000). Forgetting to check that rule is the single most common source of an off-by-one error in a hand-counted date span.

FAQ

How many days are between two dates?
Enter any two dates in YYYY-MM-DD format and the calculator shows the exact number of days between them.
Can I use this for countdowns?
Yes, enter today's date and your target date to see exactly how many days remain until that date.