Time Duration Calculator
Free time duration calculator: find the hours and minutes between two times, plus decimal hours and total minutes. Handles overnight shifts past midnight.
Updated 2026-06-09 · Free · No sign-up · Runs privately in your browser
What is a time duration calculator?
A time duration calculator finds how much time passes between a start time and an end time, then shows that gap three ways: as hours and minutes, as decimal hours, and as total minutes. It answers everyday questions like “how many hours did I work?”, “how long is this shift?”, or “how much time is between 9 AM and 5:30 PM?” without counting on your fingers or on a clock face.
You enter two clock times. The tool measures the elapsed time between them and, when the period runs past midnight, it accounts for the day rollover so an overnight shift still returns a sensible positive duration rather than a negative number.
How does the time duration calculator work?
The method is deliberately simple, which is what makes it reliable. Both times are converted to minutes since midnight, then subtracted.
The exact steps the widget uses are:
- Convert the start time to minutes since midnight:
start = hours × 60 + minutes. - Convert the end time the same way:
end = hours × 60 + minutes. - Compute the raw gap:
duration = end − start. - If
durationis negative, or the next day option is ticked, add 1440 minutes (24 hours).
From that single minute total the tool derives every output:
- Hours and minutes = whole hours from
duration ÷ 60, with the remainder as minutes. - Decimal hours =
duration ÷ 60. - Total minutes =
durationitself.
Key terms: minutes since midnight is just the clock time expressed as one number from 0 (00:00) to 1439 (23:59). The constant 1440 is the number of minutes in a full day, which is why adding it shifts the end time forward by exactly one calendar day.
Examples
Three worked examples, each matching the widget exactly.
Example 1 — a standard workday: 09:00 to 17:30. Start = 9 × 60 = 540 minutes. End = 17 × 60 + 30 = 1050 minutes. Duration = 1050 − 540 = 510 minutes. That is 8 hours 30 minutes, 8.5 decimal hours, and 510 total minutes.
Example 2 — an overnight shift: 22:00 to 06:00 with next day ticked. Start = 22 × 60 = 1320 minutes. End = 6 × 60 = 360 minutes. Raw duration = 360 − 1320 = −960, which is negative, so add 1440: −960 + 1440 = 480 minutes. That is 8 hours, 8.0 decimal hours, and 480 total minutes.
Example 3 — a short late-night gap: 23:30 to 00:15. Start = 23 × 60 + 30 = 1410 minutes. End = 0 × 60 + 15 = 15 minutes. Raw duration = 15 − 1410 = −1395, which is negative, so add 1440: −1395 + 1440 = 45 minutes (0.75 decimal hours, 45 total minutes).
The table summarises all three runs.
| Start | End | Next day | Total minutes | Hours and minutes | Decimal hours |
|---|---|---|---|---|---|
| 09:00 | 17:30 | No | 510 | 8 h 30 m | 8.5 |
| 22:00 | 06:00 | Yes | 480 | 8 h 0 m | 8.0 |
| 23:30 | 00:15 | No (auto) | 45 | 0 h 45 m | 0.75 |
Notice that Example 3 needs no checkbox: because the end time is earlier than the start, the raw gap is negative and the tool adds 1440 automatically.
What can you use a time duration calculator for?
The same calculation covers a wide range of timing tasks:
- Work hours and timesheets: total a shift from clock-in to clock-out, then read it in decimal hours for payroll. Multiply decimal hours by your rate to get gross pay.
- Night and rotating shifts: measure overnight periods that cross midnight, such as 22:00 to 06:00.
- Billing and freelancing: convert a session into minutes or decimal hours to invoice accurately.
- Cooking, study and workouts: time how long a task ran between two clock readings.
- Travel and logistics: find elapsed time between a departure and arrival within the same time zone.
Browse more calendar and clock tools in the date-time category linked at the end of this page.
Tips and common mistakes
A few things keep your results accurate:
- Use 24-hour times to avoid AM/PM mix-ups. Entering 5:30 when you meant 17:30 will give a result eight hours short. Mentally confirm whether each time is morning or afternoon.
- Remember the next day option for overnight periods. If the end time is later in the day number but earlier on the clock, tick it. The tool will also catch this automatically when the raw result is negative.
- Subtract breaks separately. The duration is the full span from start to end. For an unpaid 30-minute lunch, calculate the span, then deduct the break: an 8.5 hour span becomes 8.0 paid hours.
- Decimal hours are not “hours and minutes with a dot.” 8.5 hours means 8 hours and 30 minutes, not 8 hours 50 minutes. Decimal hours are minutes divided by 60.
- Do not chain more than one midnight. Adding 1440 once handles a single overnight crossing only.
Limitations and notes
- Minute precision only. Times are converted to whole minutes since midnight, so seconds are not measured.
- One day maximum. The calculator covers gaps up to 24 hours. A period longer than a full day, or one that spans several days, needs a date-aware tool — use the date difference calculator when full dates are involved, or the days until calculator to count down to a future date.
- Single overnight crossing. The 1440-minute rule shifts the end forward by exactly one day; it is not designed for multi-night spans.
- No time zones or daylight saving. Both times are treated as plain clock readings in the same zone, so a clock change during the period is not reflected in the result.
Note: This tool is for general timekeeping and planning. For payroll, legal or contractual hours, confirm your employer or jurisdiction’s exact rounding and break rules, as some round clock times to the nearest quarter hour before totalling.
Related tools: business days calculator and the age gap calculator. See the full date-time tools category for more.
Frequently asked questions
How do I calculate the duration between two times?+
Convert each time to minutes since midnight, subtract the start from the end, and if the result is negative add 1440 (the minutes in a day). The tool then shows that gap as hours and minutes, decimal hours and total minutes.
How many hours is 9:00 to 17:30?+
It is 8 hours and 30 minutes, which equals 8.5 decimal hours or 510 total minutes.
How do I calculate hours for an overnight or night shift?+
Tick the next day option (or simply enter an end time earlier than the start). The calculator adds 1440 minutes, so 22:00 to 06:00 overnight returns 8 hours.
What does decimal hours mean on a time card?+
Decimal hours express minutes as a fraction of an hour, so 8 hours 30 minutes becomes 8.5. Payroll systems multiply decimal hours by the pay rate, which is why timesheets often use this format.
Does the calculator include seconds?+
No. It works to the minute, converting both times to whole minutes since midnight, so the smallest unit in the result is one minute.
Why is my time difference negative without the next day option?+
A negative raw result means the end time falls on the following day. The tool automatically adds 1440 minutes so the duration is always a positive value across midnight.
How do I subtract a lunch break from the total?+
Calculate the full span first, then subtract the break separately. For a 30-minute lunch inside an 8.5 hour shift, the paid time is 8 hours, or 480 minutes.