Time calculator

Find the duration between two times, or add and subtract hours and minutes from a time.

✓ 100% free✓ No signup✓ Instant results

Time duration between two times

Total duration
Decimal hours
Total minutes

Add or subtract time

Resulting time
Day change
Last updated: July 2026Source: Minute-based time arithmetic

How time duration is calculated

The duration calculator converts both times to total minutes since midnight and subtracts the start from the end. If the end time is earlier than the start time — for example a shift that runs from 10:00 PM to 6:00 AM — it assumes the end time falls on the following day and adds 24 hours (1,440 minutes) before subtracting, so overnight spans are always calculated correctly rather than showing a negative duration.

The add/subtract tool works the same way in reverse: it converts your starting time to total minutes, adds or subtracts the hours and minutes you enter, then wraps the result using modulo 24 hours so times correctly roll over midnight in both directions. Because JavaScript's remainder operator can return negative numbers when subtracting past midnight, the calculator applies a guard (adding 1,440 minutes before taking the modulo) to always produce a valid time of day.

Converting between time formats

Time can be expressed in 12-hour format with AM/PM (e.g. 2:30 PM) or 24-hour format (e.g. 14:30), and this calculator displays results in a clean 12-hour format for readability. For payroll and timesheets, it's often useful to convert minutes into decimal hours: divide the minutes by 60, so 30 minutes becomes 0.5 hours and 45 minutes becomes 0.75 hours. A shift of 7 hours 15 minutes is therefore 7.25 decimal hours — the duration result above shows this conversion automatically.

Frequently asked questions

How do I convert minutes to decimal hours for payroll?

Divide the minutes by 60. For example, 30 minutes is 30/60 = 0.5 hours, so 2 hours 30 minutes becomes 2.5 hours. The duration result above includes a decimal hours figure for this purpose.

Does this handle times that cross midnight?

Yes. If the end time is earlier than the start time, the calculator assumes the end time falls on the next day and adds 24 hours before computing the duration.

What is the difference between 12-hour and 24-hour time?

12-hour time uses AM/PM with hours 1 through 12 (2:30 PM). 24-hour time runs from 00:00 to 23:59 without AM/PM, so 2:30 PM is written as 14:30.

How does adding or subtracting time handle going past midnight?

The calculator works in total minutes and wraps the result using modulo 24 hours, so times correctly roll over to the next or previous day instead of showing an invalid result.

Can I calculate time duration for a night shift?

Yes. Enter a start time like 10:00 PM and an end time like 6:00 AM in the duration section, and the calculator will detect the midnight crossing and return the correct total hours and minutes.

This calculator is provided for general reference. Always double-check critical time calculations for payroll, legal or medical purposes.