What is the Total Sleep Time Calculator?
This tool tells you exactly how many hours and minutes you slept between the moment you went to bed and the moment you woke up. Because most people sleep across midnight, the calculator automatically "wraps" the time around the 24-hour clock — so a 23:00 bedtime and a 07:00 wake time correctly gives 8 hours rather than a negative number. You can also subtract the minutes you spent lying awake during the night to estimate your true sleep duration.
How to use it
Enter your bedtime as an hour (0–23) and minute, then enter your wake time the same way. If you were awake during the night (trouble falling asleep, bathroom trips, restless periods), enter the total minutes awake in the optional field. The calculator returns your time in bed, the minutes deducted, and your final total sleep time in hours and minutes.
The formula explained
First the calculator finds the raw interval: Wake − Bed. If the result is negative (you woke the next day), it adds 24 hours using a modulo operation, giving the true overnight time in bed. It then subtracts your night awakenings, converted from minutes to hours:
$$\text{SleepHours} = \left(\text{Wake} - \text{Bed}\right) \bmod 24 - \frac{\text{Awake}}{60}$$
Worked example
Bedtime 22:30, wake time 06:45, awake 20 minutes. Time in bed = \((6.75 - 22.5) \bmod 24 = 8.25\) hours. Subtract \(20/60 = 0.333\) hours → \(7.917\) hours, which is 7 hours and 55 minutes of actual sleep.
FAQ
What if I go to bed and wake the same morning? As long as wake time is later than bedtime, the calculator simply returns the difference; the modulo only kicks in for overnight spans.
Does this measure sleep quality? No — it measures duration only. Sleep quality depends on cycles and disturbances not captured here.
What if my awakenings exceed time in bed? The result is floored at zero, since you cannot sleep negative hours.