Skip to content

Calculate

Time Difference Calculator

Time Difference Calculator

Work out how long there is between two times of day, including a shift that runs past midnight. Subtract an unpaid break and read the answer in hours and minutes or as decimal hours. Runs in your browser.

Use via API
  • Free, no sign-up
  • REST + MCP
  • Updated
  • Reviewed by Olgun Ozoktas
Past midnight
8h 30m
8.5 decimal hours
Hours
8
Minutes
30
Total minutes
510
Total seconds
30,600

Why Use Our Time Difference Calculator?

Working out that 09:00 to 17:30 is eight and a half hours takes a second. Working out that 22:00 to 06:00 is eight hours takes longer than it should, because the end is a smaller number than the start and the obvious subtraction gives minus sixteen. That is the case this page exists for. It wraps past midnight, subtracts an unpaid break, and gives the answer both as hours and minutes and as decimal hours, which is the form a timesheet or an invoice actually wants.

Subtracting two clock times is easy until the clock resets. From 09:00 to 17:30 the arithmetic is what you expect. From 22:00 to 06:00 it is not: the end is a smaller number than the start, and the plain subtraction gives minus sixteen hours rather than eight.

The fix is to notice that the end fell on the next day and add twenty-four hours. This page does that automatically, and the setting that controls it has three positions rather than a checkbox because the three cases are genuinely different. Auto wraps only when the end is not after the start. Always treats the end as being on the next day whatever the numbers say, so 09:00 to 17:00 becomes thirty-two hours. Never refuses to wrap at all and tells you the times look reversed.

One case is worth stating because a lot of calculators get it wrong: two identical times. A shift from 09:00 to 09:00 is twenty-four hours, not zero. Returning zero would silently lose a whole day from a timesheet, which is the kind of error nobody catches until payroll.

The other quiet trap is the twelve-hour clock. 12:00 am is midnight and 12:00 pm is noon — neither is twelve o'clock plus an offset, and adding twelve to the hour gets both of them wrong. Both are handled.

Decimal hours sits under the main answer because it is what the next step usually needs. Eight hours and thirty minutes is 8.5 on a timesheet, not 8.3, and that particular slip is common enough to be worth removing.

How it compares

A spreadsheet can do this with a formula that handles the midnight wrap, which is a formula most people look up each time. A phone's clock app gives a stopwatch, not a subtraction between two times you already know.

On FindUtils, Date Difference Calculator is the tool to use when the two moments are on different dates — it takes full date-times and returns years down to seconds. This page is for the case where there is no date at all, only two readings from a clock. If you need a whole week of entries with overtime and pay, Timesheet Calculator is the one.

Time Difference Tips

  • Auto is right almost always: it wraps only when the end is not after the start, which is exactly when a shift ran overnight.
  • Two equal times mean a full day, not zero. A 09:00 to 09:00 shift is 24 hours, and returning zero would silently lose a day.
  • Decimal hours is what payroll and invoicing use: 8h 30m is 8.5, not 8.3.
  • Set Past midnight to Always when both times are on the clock but the end really is the next day — 09:00 to 17:00 then reads as 32 hours.
  • Never refuses to wrap and reports an error instead, which is useful when you want to be told you typed the times the wrong way round.

Frequently Asked Questions

How do I calculate hours across midnight?

Enter the times as they are and leave Past midnight on Auto. When the end is not after the start, a day is added, so 22:00 to 06:00 comes out as eight hours rather than minus sixteen.

What does 09:00 to 09:00 give?

Twenty-four hours. Two equal times mean a full day, not zero — returning zero would quietly drop a day from a timesheet.

What are decimal hours?

The duration as a single number for payroll and invoicing. Eight hours and thirty minutes is 8.5 decimal hours, not 8.3, which is a common and expensive slip.

Can I subtract a lunch break?

Yes. Put the unpaid minutes in the Break field and they come off the total. A break longer than the shift is rejected rather than giving a negative answer.

Does it accept am and pm?

Yes, alongside 24-hour times. 12:00 am is treated as midnight and 12:00 pm as noon, which is the pair most calculators get wrong.

What is the difference between Auto, Always and Never?

Auto wraps past midnight only when the end is not after the start. Always treats the end as the next day regardless, so 09:00 to 17:00 becomes 32 hours. Never refuses to wrap and reports that the times look reversed.

What if my two times are on different dates?

Use the Date Difference Calculator instead. It takes full date and time values and returns the gap in years, months, days, hours, minutes and seconds.

Is my input sent anywhere?

No. The calculation runs in your browser and nothing is uploaded.

Can it handle seconds?

Yes. Enter times as HH:MM:SS and the seconds are counted and shown.

Can I use this from a script or an AI client?

Yes. The same calculation is available over HTTP and to MCP clients, so an agent can work out a shift length without opening this page.

Rate This Tool

0/1000

Get Weekly Tools

Suggest a Tool