Optimal Bedtime Calculator
Work out exactly what time to go to bed so you wake up feeling rested and aligned with full sleep cycles. Perfect for anyone who wants to stop waking up groggy.
About this calculator
The calculator finds your ideal bedtime by counting backwards from your required wake time, accounting for sleep duration, the time it takes you to fall asleep, and alignment with 90-minute sleep cycles. The core formula is: bedtime (hours) = ((wakeTime × 60 − sleepDuration × 60 − fallAsleepTime − cycleRemainder) / 60 + 24) % 24, where cycleRemainder = (sleepDuration × 60) % cycleLength. A typical sleep cycle lasts approximately 90 minutes and consists of light sleep, deep sleep, and REM sleep. Waking in the middle of a deep-sleep stage causes sleep inertia — the heavy grogginess many people feel. By timing bedtime so that your wake alarm falls near the end of a cycle, you rise during lighter sleep and feel more alert. The +24 and modulo 24 operations handle midnight rollovers in 24-hour clock arithmetic.
How to use
Example: Wake time = 7:00 AM (hour 7), sleep duration = 7.5 hours, fall-asleep time = 15 minutes, cycle alignment = 90 minutes. Step 1 — cycle remainder: (7.5 × 60) % 90 = 450 % 90 = 0 minutes (7.5 h is already a perfect 5 cycles). Step 2 — raw bedtime minutes: (7 × 60) − 450 − 15 − 0 = 420 − 450 − 15 = −45 minutes. Step 3 — add 24 h and mod: (−45/60 + 24) % 24 = 23.25 hours = 11:15 PM. Go to bed at 11:15 PM to wake refreshed at 7:00 AM after exactly 5 complete 90-minute cycles.
Frequently asked questions
Why does waking up at the end of a sleep cycle make you feel less groggy?
Each sleep cycle moves through progressively deeper stages before returning to lighter NREM and REM sleep near the end. When an alarm interrupts deep slow-wave sleep, the brain struggles to transition quickly to wakefulness, producing sleep inertia — the foggy, disoriented feeling that can last 15–60 minutes. Waking near the end of a cycle, when sleep is lightest, allows the brain to transition more smoothly. Research on sleep inertia shows that timing wake-ups to lighter sleep stages can meaningfully improve alertness, reaction time, and mood immediately upon waking, even when total sleep time is the same.
How long is a typical human sleep cycle and does it vary by person?
The average sleep cycle lasts about 90 minutes, though individual cycles can range from roughly 70 to 120 minutes. Early cycles in the night contain more slow-wave deep sleep, while later cycles contain longer REM periods. This means that if your natural cycle is closer to 100 minutes, a standard 90-minute assumption may not perfectly align for you. Some sleep tracking devices and apps attempt to estimate your personal cycle length from movement and heart rate data. For most practical purposes, planning in 90-minute blocks is a reliable starting point that works well for the majority of adults.
What is a realistic time to fall asleep and how does it affect my bedtime calculation?
Sleep onset latency — the time between lying down and actually falling asleep — averages about 10 to 20 minutes in healthy adults. If you fall asleep in under 5 minutes consistently, it may actually indicate you are sleep-deprived. Conversely, taking more than 30 minutes regularly can suggest insomnia or an overly early bedtime relative to your circadian rhythm. This calculator subtracts your fall-asleep time from the bedtime calculation, so getting into bed earlier does not translate directly into more sleep if you spend that time awake. Inputting an accurate fall-asleep estimate ensures the calculated lights-out time reflects when you actually need to be in bed.