Sleep Debt Calculator Formula
Understand the math behind the sleep debt calculator. Each variable explained with a worked example.
Formulas Used
Total Sleep Debt
total_debt = max((needed_hours - actual_hours) * days, 0)Daily Deficit
daily_deficit = max(needed_hours - actual_hours, 0)Nights to Recover (+1 hr/night)
recovery_nights = max(ceil((needed_hours - actual_hours) * days), 0)Variables
| Variable | Description | Default |
|---|---|---|
needed_hours | Hours of Sleep Needed(hours) | 8 |
actual_hours | Average Actual Sleep(hours/night) | 6.5 |
days | Number of Days(days) | 7 |
How It Works
Sleep Debt
Sleep debt is the cumulative difference between the sleep you need and the sleep you get.
Sleep Debt = (Needed - Actual) x Days
Recovery Guidelines
Chronic sleep debt cannot be fully "paid back" on weekends alone.
Worked Example
Someone who needs 8 hours but averages 6.5 hours over a week.
needed_hours = 8actual_hours = 6.5days = 7
- 01Daily deficit = 8 - 6.5 = 1.5 hours
- 02Total debt = 1.5 x 7 = 10.5 hours
- 03Recovery at +1 hr/night = 11 nights
Ready to run the numbers?
Open Sleep Debt Calculator