Working out how many hours you actually worked in a week sounds simple — until you factor in different start and end times each day, unpaid lunch breaks that vary, the occasional night shift that crosses midnight, and overtime rates that kick in above a threshold. This working hours calculator handles all of it in one place, giving you an instant total in both hours-and-minutes format and as a decimal number — the format payroll systems expect.
How it works
The core formula for each shift is:
net minutes = (end − start) − unpaid break minutes
If the end time is numerically smaller than the start time (an overnight shift), 1,440 minutes (24 hours) is added before subtracting the break, so a 22:00–06:00 shift correctly produces 480 minutes (8 hours). Negative results are clamped to zero, so a break longer than the shift produces no error.
All shifts are then summed:
total minutes = shift₁ + shift₂ + … + shiftₙ
Converting to decimal hours is straightforward:
decimal hours = total minutes ÷ 60
For example, 7 hours 30 minutes = 450 minutes ÷ 60 = 7.50 decimal hours.
Pay and overtime
When you expand the pay section the calculator applies the standard overtime formula:
gross pay = (min(totalHours, threshold) × rate) + (max(0, totalHours − threshold) × rate × multiplier)
For an employee working 44 hours at £15/hr with a 40-hour overtime threshold at 1.5×:
- Regular: 40 × £15.00 = £600.00
- Overtime: 4 × £15.00 × 1.5 = £90.00
- Gross: £690.00
In salary mode the hourly rate is derived as:
hourly rate = annual salary ÷ contracted hours per week ÷ 52
Worked example
A care worker does the following week:
| Day | Start | End | Break | Net |
|---|---|---|---|---|
| Mon | 07:00 | 15:00 | 30 min | 7h 30m |
| Tue | 07:00 | 15:00 | 30 min | 7h 30m |
| Wed | 14:00 | 22:00 | 30 min | 7h 30m |
| Thu | 22:00 | 06:00 | 30 min | 7h 30m |
| Fri | 07:00 | 13:00 | 0 min | 6h 00m |
Total: 7.5 + 7.5 + 7.5 + 7.5 + 6 = 36 hours (2,160 minutes, 36.00 decimal hours).
At £13.50/hr with no overtime threshold: gross = £486.00.
Thursday’s night shift (22:00–06:00) is handled automatically because 06:00 < 22:00 triggers the midnight-crossing logic.
Formula note
The overnight detection condition is simply:
if end < start: diff = (end + 1440) − start
No external libraries or timezone lookups are involved. Times are treated as local wall-clock times and the midnight crossing is purely arithmetic — which is correct for payroll purposes where employers record local shift start and end.