Time Card Calculation: How to Total Work Hours
How time card calculation works: converting clock-in/out pairs to hours, handling overnight shifts that cross midnight, subtracting unpaid breaks, and computing gross pay with weekly overtime at 1.5x. With examples and a free calculator.
A time card is a list of clock-in and clock-out pairs, and totaling it is two operations repeated per shift: find how long each shift lasted, then add the shifts together. The wrinkle that catches everyone is the overnight shift, where you clock out the next day at a time that looks smaller than the clock-in.
Shift duration from two clock times
A shift is recorded as a pair of HH:MM times on a 24-hour clock. To get the duration in hours, convert each time to minutes since midnight, subtract, and divide by 60:
minutes = (outHours × 60 + outMinutes) − (inHours × 60 + inMinutes)
hours = minutes / 60
A shift from 09:00 to 17:00 is 8 hours. Easy — but only because the end time is later than the start time. The instant the end time is numerically smaller, naive subtraction goes negative, which is wrong for a real worked shift.
The overnight shift: wrap past midnight
If you clock in at 22:00 and out at 06:00, the end time (360 minutes) is smaller than the start (1320 minutes). The shift did not run backwards — it crossed midnight. The fix is to detect end < start and add a full day:
if (endMinutes < startMinutes) endMinutes += 24 × 60
Now 360 + 1440 − 1320 = 480 minutes = 8 hours, which is correct. Any time-card tool that doesn't handle the wrap gives negative or nonsensical hours for night shifts and graveyard shifts, which are exactly the shifts most likely to cross midnight.
Unpaid breaks and gross hours
Most time cards include an unpaid break (lunch). Subtract the break from the shift duration, clamped to the shift length so a typo of "120 minute break" on a 60-minute shift doesn't produce negative hours. The per-shift formula becomes:
worked = shiftDuration − min(break, shiftDuration)
Sum the worked hours across every shift to get the weekly total. Whether breaks are paid or unpaid is a policy decision the tool should let you control, but the math is always: worked time equals total clocked time minus unpaid breaks.
Overtime: the weekly threshold
In the US, the Fair Labor Standards Act sets overtime at more than 40 hours in a workweek, paid at 1.5× the regular rate (some states set a daily overtime threshold too). The standard computation:
regular = min(totalHours, 40)
overtime = max(0, totalHours − 40)
gross = regular × rate + overtime × rate × 1.5
A 46-hour week at $20/hr pays 40 × $20 + 6 × $20 × 1.5 = $800 + $180 = $980. The threshold is weekly by default, which is why a single long Saturday shift can push you into overtime even if your weekday shifts were short — the week is the unit, not the day.
From hours to a paycheck
Once you have gross hours and a pay rate, the jump to a paycheck is multiplying hours by rate — and then the deductions begin. Income tax, FICA, and any pre- or post-tax deductions turn gross pay into net pay, which is what the Payroll Calculator handles. For converting an hourly rate into an annual figure without deductions, the Salary Calculator does the gross annualization, and the Time Duration Calculator works out a single elapsed-time span between any two clock times.
Try it yourself
The Time Card Calculator totals work hours from clock-in/out shifts, handles overnight wraps and unpaid breaks, and computes gross pay with weekly overtime. Enter one shift per line as in-and-out times and it returns a per-shift breakdown plus the weekly total.