How to Calculate Hours Between Two Times: Overnight Shifts, Breaks and Decimal Hours

“How long did that take?” sounds like the simplest question in the world until the shift crosses midnight — and then most people's arithmetic quietly breaks. Our time duration calculator answers it properly: pick a start time and an end time, optionally enter a break in minutes, and it returns the duration as hours and minutes, as decimal hours for timesheets and billing, and as total minutes. End time earlier than start time is not an error; it is an overnight shift, and the calculator handles it automatically. This guide explains the one formula behind it, works the overnight example in full, and covers breaks, split shifts and the mistakes that cost people pay.

How to Use the Calculator

1. Pick your start time and end time using the time pickers, then press Calculate Duration. 2. Add a break if there was one. The break field takes minutes — enter 60 for a one-hour lunch, 30 for half an hour — or leave it empty or 0 for no break. The result is your true working time, not just the time between clock-in and clock-out. 3. Read all three outputs. Hours and minutes is what humans say (“7 h 30 min”); decimal hours is what payroll systems want (“7.50”); total minutes is the check figure that settles arguments. One guardrail matters: the break can never equal or exceed the total shift, and the tool will tell you if it does — a break longer than the shift is a data-entry error, not a working day.

The Formula: Minutes Since Midnight, Plus the Overnight Rule

Both times are converted to minutes since midnight, then subtracted. The overnight rule is the only subtlety: if the end time is earlier than (or equal to) the start time, the calculator assumes the shift crossed midnight and adds 24 hours rather than giving you a negative answer. In symbols: if end ≤ start, duration = (end − start) + 24 hours; then net = duration − break. So 22:00 to 06:00 becomes (360 − 1,320) + 1,440 = 480 minutes = 8 hours, and a 30-minute break gives 7 h 30 min net, or 7.50 decimal hours. Without the overnight rule, that same subtraction produces −960 minutes — the classic error this calculator exists to prevent, and the one that turns a night shift into a negative number on a spreadsheet. Decimal hours are what payroll wants because 7.5 × hourly rate is trivial arithmetic, while 7 h 30 min × rate invites slips; 7.50 hours × 6 days = 45 hours is unambiguous in a way “about seven and a half” is not, and it matches how most payroll software records time.

Worked Example: The Night Guard's Shift

A security guard works 10:00 PM to 6:00 AM with a 30-minute break. Step 1: start in minutes, 22 × 60 = 1,320. Step 2: end in minutes, 6 × 60 = 360. Step 3: overnight adjustment, (360 − 1,320) + 1,440 = 480 minutes = 8 h. Step 4: deduct the break, 480 − 30 = 7 h 30 min. Step 5: decimal hours, 450 ÷ 60 = 7.50 hours. At $25 an hour, that shift pays 7.5 × 25 = $187.50. The same method covers the everyday cases too: an office day of 9:00 AM to 6:00 PM with a 60-minute lunch is 9 h − 1 h = 8 h; a night factory shift of 10:00 PM to 6:00 AM with a 30-minute break is 7 h 30 min; and an overtime check of 8:00 AM to 8:00 PM with a 60-minute break is 11 h, which is 3 h of overtime over an 8-hour day. Once the hours are right, our overtime pay guide turns them into money at the 1.5× rate, and our take-home pay guide shows what survives tax on the way to your bank account.

Split Shifts, Breaks and Overtime Checks

Two practical tips. First, split shifts: the calculator handles one continuous block at a time, so a restaurant split of 11:00 AM to 3:00 PM plus 7:00 PM to 11:00 PM means running the tool twice and adding the results — 4 h + 4 h = 8 h. Second, overtime disputes: screenshot or note the decimal-hours figure each week, because a written “7.50 hours × 6 days = 45 hours” settles a pay query in a way a remembered “about seven and a half” never will. The break field deserves the same care: deduct only unpaid time. If your lunch is paid, it stays in the total; if it is unpaid, it comes out. And always sanity-check the result against the clock: a 9-to-5 with an hour's lunch cannot be 9 hours, and a night shift cannot be negative. If either appears, the start and end times are the wrong way round — the most common cause of a wrong answer is a PM entered as an AM.

Common Mistakes

Forgetting the overnight rule. 10:00 PM to 6:00 AM is 8 hours, not −16. If your spreadsheet says negative, add 24 hours. Counting the break twice — or not at all. Unpaid breaks come out once; paid breaks stay in. AM/PM slips. Entering 6:00 PM as 6:00 AM turns an evening shift into a morning one; double-check the picker before calculating. Multiplying hours-and-minutes by a rate. Convert to decimal hours first — 7.5 × $25 is $187.50, while 7 h 30 min × $25 invites an arithmetic slip. Treating multi-day spans as one block. The calculator assumes a single continuous block of at most 24 hours; multi-day durations belong in a date-difference calculation, not a clock calculation. Ignoring daylight saving. The tool uses plain clock arithmetic, so durations measured across a spring-forward or fall-back change are not adjusted for the lost or gained hour — most US states observe daylight saving, so check those two weekends by hand.

Limits Worth Knowing

The calculator assumes a single continuous block of at most 24 hours and minute precision — seconds are ignored. It does not know about public holidays, weekends or different overtime rates; it gives you hours, and your pay rules turn hours into dollars. Within those limits it is exact: the same minutes-since-midnight arithmetic, the same overnight rule, and the same three outputs every time, which is precisely what a timesheet needs.

Frequently Asked Questions

How do I calculate hours between two times?
Subtract the start time from the end time. For example, 9:00 AM to 5:30 PM is 8 hours 30 minutes. If the end time is earlier than the start, add 24 hours — the shift ran overnight.
How does the calculator handle overnight shifts?
If the end time is earlier than (or equal to) the start time, the calculator assumes the shift crossed midnight and adds 24 hours. A 10:00 PM to 6:00 AM shift is 8 hours, not a negative number.
How do I deduct a break from the total?
Enter the break in minutes — 60 for a one-hour lunch, 30 for half an hour — and the calculator subtracts it: 480 minutes minus a 30-minute break is 7 h 30 min. The break can never equal or exceed the total shift.
What are decimal hours, and why does payroll want them?
Decimal hours express minutes as a fraction of an hour: 7 h 30 min is 7.50 hours. Payroll systems want them because multiplying is trivial — 7.5 × $25 an hour is $187.50 — while hours-and-minutes × rate invites arithmetic slips.
Can it handle split shifts or multi-day durations?
Split shifts need two runs: calculate each block separately and add the results — 11:00 AM to 3:00 PM plus 7:00 PM to 11:00 PM is 4 h + 4 h = 8 h. Multi-day durations need a date-difference calculation, since this tool handles one continuous block of at most 24 hours.

More guides from ToolNest

How to Calculate Overtime Pay: The 1.5× Formula, Worked Examples and the Averaging Trap

Split the week at 40 hours, price the premium at 1.5× — a 47-hour week at $18.50 worked to $934.25, a California 14-hour day, and why averaging two weeks is illegal.

How to Calculate Take-Home Pay: Federal Tax, FICA and the State Difference

Standard deduction, marginal brackets, FICA and state tax in order — a $75,000 salary worked to $2,368.94 per check in Texas vs $2,288.32 in California.

How to Calculate Fuel Cost for a Road Trip: Miles, MPG and Cost Per Mile

The miles ÷ MPG × price formula, the 240-mile $30.00 worked example (and $42.00 in an SUV), measuring your real MPG, and the habits that cut cost per mile.