Sleep Window Calculator: Your Ideal Bedtime & Wake Time
Enter your wake time, chronotype, and age to get your personalised optimal sleep window with deep sleep and REM timing.
Built by Adil Sattar · Educational tool, not medical advice
The exact formula this calculator uses
Subtracts an age-based sleep duration, a fixed 15-minute fall-asleep allowance and a chronotype shift from your wake time to get a bedtime, then labels fixed 'deep sleep' and 'REM' windows relative to bedtime and wake time.
Formula
Bedtime
Bedtime = (WakeTime − Duration×60 − 15 + Shift) mod 1440 minutesShift = −60 (Early Bird), 0 (Bear), +60 (Night Owl). Wake time is never shifted. Minutes are floored when formatted HH:MM; +1440 then mod 1440 handles wrap past midnight.
Deep sleep window
Start = Bedtime; End = Bedtime hour + 3 (same minutes), mod 24 hoursSimply the first 3 hours after the bedtime clock time.
Peak REM window
Start = (Wake hour − 2) mod 24 at the wake minutes; End = WakeTimeSimply the last 2 hours before wake time.
Displayed duration
Duration shown = the age-group hours (unchanged by chronotype)
Inputs
| Input | Meaning | Range / options |
|---|---|---|
| WakeTime | Required wake time | time input, default 06:30 |
| AgeGroup | Selects Duration (hours) | select of 8 groups, default Adult (index 6) |
| Chronotype | Early Bird / Bear / Night Owl | 3 buttons, default Bear (intermediate) |
Constants and where they come from
- Age durations (h): Newborn (0–3 mo) = 16.5; Infant (4–11 mo) = 14; Toddler (1–2 yr) = 12.5; Preschool (3–5 yr) = 11; School-age (6–12 yr) = 10; Teen (13–17 yr) = 9; Adult (18–64 yr) = 8; Older adult (65+) = 7.5. rule-of-thumb used by this tool (labelled 'recommended' in the dropdown; no source cited in the code)
- Fall-asleep allowance: 15 min. rule-of-thumb used by this tool
- Chronotype shift: −60 / 0 / +60 min. rule-of-thumb used by this tool
- Deep window length: 3 h. rule-of-thumb used by this tool
- REM window length: 2 h. rule-of-thumb used by this tool
Cutoffs and labels
- Chronotype → shift: early −60, intermediate 0, late +60 minutes
- No scoring bands; results appear only after pressing Calculate
Worked example
Inputs: Wake 06:30, Adult (8 h), Night Owl
- Wake = 390 min; 390 − 480 − 15 + 60 = −45; +1440 = 1395; mod 1440 = 1395 → 23:15
- Deep window: 23:15–02:15
- REM window: 04:30–06:30
- Displayed duration: 8 hours
- For comparison, Bear gives bedtime 22:15 and Early Bird gives 21:15
Result: Bedtime 23:15 → wake 06:30; deep 23:15–02:15; REM 04:30–06:30; "8 hours of sleep opportunity"
Educational estimate; the deep and REM windows are fixed clock offsets, not predictions from sleep staging. Oddity in code: the chronotype shift moves only the bedtime, so Night Owl actually gets 1 h less than the displayed duration (and Early Bird 1 h more) while the page still shows the unshifted hours.
Formula checked against the calculator's code: November 2026. Written out by Adil Sattar. Found a mistake? Tell us.
Frequently asked questions
What is an optimal sleep window?+
Your optimal sleep window is the specific bedtime-to-wake window that aligns with your circadian rhythm, provides your required sleep duration, and maximises the proportion of restorative deep and REM sleep. Unlike a generic 'bedtime,' it is personalised to your age, chronotype, and schedule constraints.
How do I find my optimal bedtime?+
Work backwards from your required wake time. Subtract your optimal sleep duration (8 hours for most adults), then add 15 minutes for sleep onset. For example, a 6:30 AM wake time with an 8-hour sleep need gives an optimal bedtime of 10:15 PM. Adjust based on your chronotype — night owls should shift 1–2 hours later.
Does sleep timing matter as much as duration?+
Yes — both matter independently. 8 hours of sleep starting at 4 AM produces less restorative sleep than 8 hours starting at 10 PM for most adults, because the early-morning timing misaligns with the circadian deep sleep and REM windows. The concept of 'sleep debt' accounts for duration; 'circadian misalignment' captures the timing dimension.
What is the best time to sleep for deep sleep?+
Deep sleep (slow-wave sleep) is heavily concentrated in the first 2–3 hours of the sleep period. Bedtimes between 9 PM and midnight for intermediate chronotypes tend to produce the most deep sleep because they align with the natural cortisol drop and melatonin rise. Going to bed after midnight typically means entering the deep sleep window later, reducing SWS quantity.
Should everyone sleep at the same time?+
No. Chronotype varies enormously across the population. Extreme morning types naturally sleep from 9 PM to 5 AM. Extreme evening types sleep from 1–2 AM to 9–10 AM. Forcing either to conform to the other's schedule produces chronic circadian misalignment. The optimal sleep window respects individual chronotype.
How does age affect optimal sleep timing?+
Chronotype shifts dramatically across the lifespan. Children are naturally early types. Adolescents shift 2–3 hours later (a genuine biological phenomenon, not laziness). Adults gradually shift earlier again. By age 65+, most people have shifted back to early-morning preferences. The optimal sleep window must be recalibrated as you age.
Related calculators
Circadian Rhythm Calculator: Find Your Body Clock Schedule
Circadian rhythm calculator: discover your ideal sleep-wake window and peak performance times by chronotype.
OpenBedtime Calculator: What Time Should You Go to Sleep?
Bedtime calculator: know exactly when to fall asleep based on your wake-up time and natural sleep cycles.
OpenChronotype Quiz: Are You a Lion, Bear, Wolf or Dolphin?
Chronotype quiz: are you a Lion, Bear, Wolf, or Dolphin? Find your chronotype and your ideal daily schedule.
OpenWake Up Time Calculator: When Should You Set Your Alarm?
Wake-up time calculator: discover the best time to wake up based on when you go to sleep tonight.
Open