Skip to content
Everyday Life

Time Difference Calculator

Enter a start time and an end time to find the exact duration between them. The calculator shows the difference in hours, minutes and seconds, plus a decimal-hours figure useful for payroll and timesheets. It handles spans that cross midnight automatically, and a "show your work" panel walks through every step of the arithmetic.

Your details

Enter the start time in HH:MM or HH:MM:SS format.
Enter the end time in HH:MM or HH:MM:SS format.
Optional unpaid break or deduction in minutes (e.g. 30 for a lunch break).
min
Turn on when the end time is on the next calendar day (e.g. a night shift from 22:00 to 06:00).
Total duration
8h 30m

Elapsed time in hours, minutes and seconds

Hours8
Minutes30
Seconds0
Total minutes510
Decimal hours8.5
Total seconds30,600
Hours8
Minutes30
Seconds0

Duration: 8h 30m

  • The elapsed time is 8 hours and 30 minutes.
  • In decimal hours (for payroll or timesheets) that is 8.5000 hours, or 510.00 minutes.

Next stepIf you are calculating worked hours, remember to check whether your start and end times already exclude lunch or whether you need to apply a break deduction.

How the calculator works

The calculator converts both times into a count of seconds measured from midnight (00:00:00). It then subtracts the start value from the end value and, if you toggled "crosses midnight", adds 86,400 seconds (one full day) so that a night shift such as 22:00 to 06:00 comes out at 8 hours rather than -16 hours. Any break deduction you enter is subtracted last. The final total is then split back into whole hours, remaining minutes and remaining seconds, and also expressed as a single decimal-hours figure, which most payroll and billing systems expect.

Decimal hours and payroll

Clocks show time in a sexagesimal system (base 60), but spreadsheets, invoices and payroll software normally expect decimal numbers. To convert, divide the total elapsed seconds by 3,600. A 7-hour 30-minute shift becomes 7.5 decimal hours; 6 hours 45 minutes becomes 6.75. This calculator does that conversion automatically. If you need to reverse the process, multiply the decimal part by 60: 0.75 hours x 60 = 45 minutes.

Handling midnight crossings

When a shift, flight, or event starts before midnight and ends after it (for example, 23:00 to 07:30), the naive subtraction gives a negative number. Enabling the "crosses midnight" option adds exactly 24 hours to the result, producing the correct 8-hour 30-minute answer. If your span is longer than 24 hours, use a date-and-time calculator that accepts full calendar dates instead.

Break deductions and net work time

Labor law in most countries distinguishes between "clock-on" hours and the net paid time after unpaid rest periods. A common example is a 9-to-5 shift with a 30-minute unpaid lunch: gross duration is 8 hours, net paid time is 7 hours 30 minutes. Enter the break length in minutes in the "Break / deduction" field and the calculator subtracts it from the gross span, showing the net duration you actually need to record on a timesheet.

Quick time unit conversions

UnitSecondsMinutesHours
1 minute6010.01667
1 quarter hour900150.25
1 half hour1 800300.5
1 hour3 600601
1 shift (8 h)28 8004808
1 day86 4001 44024

Reference for converting between common time units.

Frequently asked questions

How do I calculate the time difference between two times?

Convert each time to seconds from midnight (hours x 3,600 + minutes x 60 + seconds), subtract the smaller from the larger, then convert back. For example, 09:00 = 32,400 s and 17:30 = 63,000 s; 63,000 - 32,400 = 30,600 s = 8 hours 30 minutes.

What is decimal hours and why is it used?

Decimal hours express a duration as a single decimal number rather than hours-and-minutes. You get it by dividing total seconds by 3,600 (or total minutes by 60). It is the standard format for timesheets, invoices, and most payroll software because it is easy to multiply by an hourly rate.

How do I calculate time across midnight?

Subtract the start time from the end time in seconds. If the result is negative (because the end is earlier in the day than the start), add 86,400 seconds (24 hours). For a shift from 22:00 to 06:00: 6 x 3600 - 22 x 3600 = 21,600 - 79,200 = -57,600; add 86,400 to get 28,800 s = 8 hours.

How do I subtract a break from worked hours?

Calculate the gross time span first, then subtract the break duration in seconds. For a 9:00-17:30 shift with a 30-minute break: gross = 8.5 hours = 30,600 s; break = 1,800 s; net = 30,600 - 1,800 = 28,800 s = 8 hours. Enter the break length in the "Break / deduction" field and this calculator handles it automatically.

What is the difference between total minutes and minutes in the breakdown?

Total minutes is the entire duration expressed as one number (for example, 510 for 8 hours 30 minutes). "Minutes" in the hours-minutes-seconds breakdown is only the remaining minutes after the whole-hour portion has been removed (so 30 for 8 h 30 m). Use total minutes when you need a single value for further calculations.

Can I use this for longer spans, like days?

This calculator is designed for within-day or overnight (crossing midnight once) time spans. If your event lasts more than 24 hours, you need to enter dates as well as times. Use a date duration calculator that accepts full calendar dates for multi-day spans.

Sources

Written by Grace Mbeki, MSc Data Scientist & Educator · Nairobi, Kenya

Turning everyday numbers into clear, actionable answers for the decisions that matter most.

Search 3,500+ calculators

Loading search…