How to calculate working hours between two timestamps excluding breaks

Date and time

How to calculate working hours between two timestamps excluding breaks

Published: July 29, 2026
Updated: July 29, 2026

how to calculate working hours between two timestamps excluding breaks

Calculating working hours between two timestamps is essential for payroll, time tracking and project reporting. This guide shows the formula, step-by-step manual method, practical examples and how to use an online calculator to get accurate totals while excluding unpaid breaks or non-working periods.

What this calculation is and when to use it

This calculation measures the total paid working time between a start timestamp and an end timestamp, subtracting breaks and any non-working intervals (lunch, rest, meetings not billable). Use it for timesheets, invoicing clients, calculating overtime, or verifying worked hours for payroll.

basic concept and formula

At its core, the calculation converts timestamps to decimal hours, subtracts break durations and sums the result. A simple formula for a single shift:

Total working hours = (End time − Start time) − Sum of break durations

For multiple shifts or intervals in the same day or across days, sum each valid working interval and subtract breaks for those intervals.

step-by-step method to calculate manually

  1. Write down the start and end timestamps in 24-hour format (or convert AM/PM to 24-hour).
  2. If the end time is on the next day, add 24 hours to the end time before subtracting.
  3. Convert each timestamp to decimal hours: hours + minutes/60 + seconds/3600 (if needed).
  4. Calculate raw duration: End (decimal) − Start (decimal).
  5. List all break periods and convert each break to decimal hours. Sum break durations.
  6. Subtract total breaks from raw duration to obtain total working hours. If negative, result is zero.

converting time to decimal hours (quick reference)

To convert hh:mm to decimal hours:

  • Decimal hours = hh + (mm ÷ 60)
  • Example: 9:30 → 9 + 30/60 = 9.5 hours

example 1 — single shift with one lunch break

Scenario: Start 08:45, End 17:15, Lunch 00:45 (45 minutes).

  • Start decimal = 8 + 45/60 = 8.75
  • End decimal = 17 + 15/60 = 17.25
  • Raw duration = 17.25 − 8.75 = 8.5 hours
  • Breaks = 45/60 = 0.75 hours
  • Total working hours = 8.5 − 0.75 = 7.75 hours (7 hours 45 minutes)

example 2 — overnight shift spanning two days

Scenario: Start 22:30, End 06:15 next day, Break 00:30 (30 minutes).

  • Convert times: Start = 22.5, End = 6.25 but add 24 to end since next day → 30.25
  • Raw duration = 30.25 − 22.5 = 7.75 hours
  • Breaks = 0.5 hours
  • Total working hours = 7.75 − 0.5 = 7.25 hours (7 hours 15 minutes)

example 3 — multiple intervals in a day

Scenario: Morning 08:00–12:00, Afternoon 13:00–17:30, Coffee break 00:15 in the morning.

  • Morning duration = 12.00 − 8.00 = 4.00 hours
  • Afternoon duration = 17.5 − 13.0 = 4.5 hours
  • Total raw = 4.0 + 4.5 = 8.5 hours
  • Breaks = 0.25 hours
  • Total working hours = 8.5 − 0.25 = 8.25 hours (8 hours 15 minutes)

how to handle paid breaks, rounding and overtime rules

  • If a break is paid, do not subtract it.
  • Round according to policy: common practices are round-to-nearest-5-minutes, round-up, or round-down. Apply rounding only after summing total minutes to avoid cumulative rounding errors.
  • Overtime calculations normally start after a threshold (e.g., 8 hours/day). Use the total working hours result to determine overtime payability.

common errors and how to avoid them

  • Forgetting to add 24 hours when the shift ends next day — always check date context.
  • Converting AM/PM incorrectly — verify 12 AM = 00:00, 12 PM = 12:00.
  • Subtracting breaks twice when breaks are recorded as non-working intervals — only subtract break durations once.
  • Rounding each interval separately — sum minutes first, then round the final result if needed.

how to calculate using an online calculator

Use a time difference or working hours calculator to speed the process. A typical flow on an online tool:

  1. Enter start date & time and end date & time.
  2. Add break intervals or enter total break minutes.
  3. Choose whether breaks are paid or unpaid and apply rounding rules if available.
  4. Click calculate to get total working hours in decimal and hours:minutes format.

Try a reliable online time calculator at Calculatorr to handle overnight shifts, multiple breaks and automatic conversion to decimal hours.

table — quick conversion from minutes to decimal hours

MinutesDecimal hours
150.25
300.5
450.75
601.0

interpreting results

The final number tells you how many paid hours the employee or contractor worked between the given timestamps. Use the decimal value to multiply by the hourly rate when calculating pay. Convert back to hours:minutes for timesheet presentation (for example, 7.75 → 7 hours 45 minutes).

example — calculating pay from working hours

  • Total working hours = 7.75
  • Hourly rate = $18.00
  • Gross pay = 7.75 × 18.00 = $139.50

tips for accurate time tracking

  • Record exact start/end timestamps (include seconds if available) and breaks as separate entries.
  • Use devices or clocking systems that export timestamps to avoid manual entry errors.
  • Always verify overnight shifts against dates to ensure correct day attribution.

how to extend this calculation for teams and payroll

For many employees, repeat the calculation row-by-row and sum totals. Export data to CSV and use spreadsheet formulas (SUM of durations minus SUM of breaks) or use a time-tracking tool with payroll export. For recurring schedules, build templates for common shift patterns to reduce manual calculations.

final checklist before submitting timesheets

  • Confirm start and end timestamps are correct and include date for overnight cases.
  • Ensure all unpaid breaks were listed and subtracted.
  • Apply agreed rounding policy consistently across all entries.
  • Validate totals match punch-in/punch-out logs or digital timecards.

Use the example workflows and the Calculatorr time tools to quickly convert timestamps to accurate working hours and calculate pay or billable time. Accurate time calculation prevents payroll errors and ensures fair billing for work completed.

Image suggestions:

  • Place near the top under the main H2: illustrative image of a digital clock and calendar overlay showing start and end times. Alt text: 'calculate working hours between two timestamps example digital clock'
  • Place near the examples section: screenshot of a time calculator form with start/end fields and break input. Alt text: 'working hours calculator form with breaks input'

Why Choose Calculatorr.com?

We're dedicated to providing the most accurate, easy-to-use calculators for all your needs.

100% Free

All of our calculators are completely free to use, no hidden fees or subscriptions.

Private & Secure

Your data never leaves your browser. We don't store any of your calculations.

Mobile Friendly

Use our calculators on any device - desktop, tablet, or smartphone.