Time Difference Calculator
The time difference calculator finds the exact gap between two clock times in hours, minutes, total minutes, and total seconds. Enter a start time and an end time and the result updates instantly. A checkbox lets you mark spans that cross midnight, such as night shifts or red-eye flights, so the calculator adds 24 hours to the end time before computing the difference.
Common uses include tracking work shifts and break times, calculating study or exercise session lengths, timing cooking or manufacturing processes, planning travel itineraries, and verifying overtime under the Fair Labor Standards Act. The FLSA requires employers to compensate employees for all hours worked, so an accurate count of time worked is essential for payroll compliance. For work-hours calculations that include break deductions, the hours between times calculator may be more appropriate. For time zone conversion across geographic regions, use the time zone converter.
Formula
startMins = startHH * 60 + startMM
endMins = endHH * 60 + endMM
if (crossesMidnight and endMins < startMins) endMins += 1440
diff = endMins - startMins
hours = Math.floor(diff / 60)
minutes = diff % 60
totalSeconds = diff * 60
Quick reference: common time spans
30 minutes = 1,800 seconds. 1 hour = 60 minutes = 3,600 seconds. 8 hours = 480 minutes = 28,800 seconds. 12 hours = 720 minutes = 43,200 seconds. A standard 8-hour workday from 9:00 AM to 5:00 PM produces exactly 480 minutes or 28,800 seconds. A 7.5-hour shift from 8:00 AM to 3:30 PM (with no break deducted) gives 450 minutes.
Overnight shifts
For a shift that starts in the evening and ends the following morning, check the crosses-midnight box. For example, a 10:00 PM to 6:00 AM shift spans 8 hours. Without the overnight flag, the calculator would return a negative result. With it enabled, 6:00 AM is treated as 30:00 (1,800 minutes into the next day), giving 1,800 - 1,320 = 480 minutes.
Time difference calculator: frequently asked questions
How do I calculate the time difference between two times?
Convert both times to minutes since midnight, then subtract the start from the end. For example, 9:00 AM is 540 minutes and 5:30 PM is 1,050 minutes. The difference is 510 minutes, which is 8 hours and 30 minutes. This calculator does this automatically for any two times you enter.
What if the time spans midnight?
Check the 'Crosses midnight' checkbox. The calculator will add 1,440 minutes (24 hours) to the end time before subtracting the start time. For example, a shift from 10:00 PM to 6:00 AM would normally give a negative result, but with the overnight option enabled it correctly calculates 8 hours.
How many minutes are in an hour?
There are 60 minutes in one hour. So 1.5 hours is 90 minutes, 2 hours is 120 minutes, and 8 hours is 480 minutes. To convert a number of minutes to hours, divide by 60.
How do I convert minutes to hours?
Divide the total minutes by 60 to get decimal hours. For example, 90 minutes divided by 60 equals 1.5 hours. To get hours and remaining minutes separately, take the integer part (Math.floor) for whole hours and the remainder (modulo 60) for leftover minutes. This calculator shows both formats.
What is the maximum time difference possible?
On the same calendar day without crossing midnight, the maximum time difference is 23 hours and 59 minutes (from 12:00 AM to 11:59 PM, or 1,439 minutes). With the crosses-midnight option enabled, you can represent a span of up to 23 hours and 59 minutes across two calendar days.
Official sources
- NIST Time and Frequency Division: Time Services.
Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.