| Window | Bedtime | Projected SE | Goal gap | Shift vs current | Projected review band | Copy |
|---|---|---|---|---|---|---|
| {{ row.window_label }} | {{ row.bedtime }} | {{ formatPercent(row.projected_efficiency) }} | {{ formatSignedPercent(row.goal_gap) }} | {{ row.shift_label }} | {{ row.review_band_label }} |
| Priority | Checkpoint | Action | Trigger | Next window | Bedtime | Copy |
|---|---|---|---|---|---|---|
| {{ row.priority }} | {{ row.checkpoint }} | {{ row.action }} | {{ row.trigger }} | {{ row.next_window }} | {{ row.bedtime }} |
| Observed SE band | Action | Window change | Bedtime | When to choose it |
|---|---|---|---|---|
| {{ row.threshold }} | {{ row.action }} | {{ row.window_change }} | {{ row.bedtime }} | {{ row.reason }} |
A sleep window in cognitive behavioral therapy for insomnia (CBT-I) is a planned block of time in bed that is meant to track sleep. Matching that window more closely to real sleep can reduce long awake stretches in bed and make a fixed morning rise time easier to protect. This calculator turns that planning problem into a bedtime recommendation and a comparison set of nearby options.
It works best when you already have a recent diary-based average for total sleep time and you want to test what different windows would imply before you change your schedule. With a wake target of 06:30, for example, a 6h 45m window points to a 23:45 bedtime, while a 7h 15m window moves bedtime earlier and usually lowers the projected efficiency percentage.
The page is a planning aid, not a diagnosis engine and not a full CBT-I program. It compares candidate windows, estimates what sleep efficiency would look like if baseline sleep stayed the same, and adds coaching cues about restriction pressure and review timing.
That distinction matters because some outputs are intentionally mechanical. A very short candidate window can push the projected efficiency percentage above 100, which does not mean sleep became superhuman; it only means the chosen time in bed is shorter than the baseline sleep amount fed into the formula.
This health information is for planning and discussion only. Sleep restriction elements of CBT-I can temporarily increase daytime sleepiness and may need clinician supervision when driving safety, bipolar disorder, seizure risk, parasomnias, or untreated sleep apnea are part of the picture.
Start with your recent average sleep time, keep the default 85% goal for a first pass, and leave the advanced panel alone until you have seen one full run. That baseline pass shows whether the recommendation stays close to your diary average or stretches toward a longer window that only grazes the goal.
This tool is most useful when you are comparing a small number of realistic bedtime options around a fixed wake time. It is a poor fit for choosing treatment from one rough night, for guessing without a diary average, or for treating the most aggressive row in the table as an automatic target.
Pressure Δ, Fatigue risk, and the first row in Coaching Plan before you treat the window as workable.Projected SE.Fixed wake time, Window step, and Rounding mode unchanged so differences in Goal Gap come from the assumption you meant to test.The calculator builds a grid of candidate time-in-bed windows from the minimum window to the maximum window, stepping through that range in 10, 15, 20, or 30 minute increments. For every candidate, it counts backward from the fixed wake time to produce a bedtime and then asks what sleep efficiency would be if baseline total sleep time stayed unchanged.
The projected efficiency number is a ratio, not a sensor reading. Shorter windows drive the percentage upward, longer windows drive it downward, and the same wake time keeps the bedtime comparison clean across rows. The default goal is 85%, a common CBT-I benchmark, but the calculation follows whatever goal you enter.
The recommendation itself is not simply the row with the highest percentage. The script first finds the baseline-snapped window nearest your diary average after applying the selected rounding mode. It also finds the goal-aligned window nearest the duration implied by baseline sleep and the chosen efficiency goal. If that goal-aligned row lands within 0.5 percentage point of the goal, the tool recommends it; otherwise it falls back to the baseline-snapped row.
Max restriction acts only as an eligibility ceiling for the recommendation. The Window Scenarios table can still show more aggressive rows below that ceiling, which is why it is possible to see High fatigue-risk rows even when the final recommendation stays more conservative.
The core percentage is calculated as baseline total sleep time divided by the candidate window, multiplied by 100.
With baseline total sleep time of 5.2 hours, the tool converts that to 312 minutes. A 5h 45m window is 345 minutes, so the projected efficiency becomes 100 × 312 ÷ 345 = 90.4%, which is why that row shows On target against a 90% goal.
| Output cue | Boundary rule | How to read it |
|---|---|---|
Status: Above target |
Goal Gap >= +2.0 |
The candidate window clears the chosen goal with visible margin. |
Status: On target |
-1.0 <= Goal Gap < +2.0 |
The row sits in the tool's closest match band. |
Status: Near target |
-4.0 <= Goal Gap < -1.0 |
One step shorter can change the label. |
Status: Below target |
Goal Gap < -4.0 |
The window is longer than baseline sleep supports for that goal. |
Fatigue risk |
Restriction >= 90 min = High; 60 to <90 = Moderate |
A package heuristic based only on how much shorter the row is than baseline sleep. |
Pressure band |
<= 45 min = Conservative; >45 to <=90 = Balanced; >90 = Aggressive |
Applied only to the recommended row. |
The two-week adaptation plan uses the recommended window for days 1 to 7 as Stabilize. Days 8 to 14 switch to Consolidate. Week 2 expands by exactly one step only when the recommended projected efficiency is at least 4 points above goal; otherwise the window stays unchanged.
Adaptation cadence does not change the scenario math or the initial recommended window. It changes coaching priorities and review timing, making safety items heavier in conservative mode and progression items heavier in accelerated mode.
All of this logic runs in the page script. This package does not define a tool-specific upload path or server-side sleep calculation.
| Field | Role in the calculation |
|---|---|
Baseline total sleep time |
Sets the sleep amount reused across every candidate window. |
Fixed wake time |
Anchors every bedtime and must be valid before any results render. |
Sleep efficiency goal |
Defines Goal Gap, row labels, and recommendation eligibility. |
Window step and Rounding mode |
Control the comparison grid and how baseline or goal durations snap to that grid. |
Recommended Sleep Window |
Combines the recommendation rule with bedtime, restriction minutes, and pressure band. |
Coaching Plan |
Ranks safety, stability, wake-anchor, and progression messages for the selected cadence. |
Use one steady pass before you start comparing alternatives.
Baseline total sleep time from a recent diary average and set Fixed wake time. Once the wake time is valid, the summary box and result tabs can render.Sleep efficiency goal at 85% for a first pass or enter the target you want to test. Read Recommended Sleep Window, bedtime, Projected SE, and Gap together.Advanced only if you need tighter bounds. Adjust Minimum window, Maximum window, Window step, and Rounding mode, then confirm that the rows in Window Scenarios now sit on the grid you intended.Max restriction to cap how much shorter than baseline the recommendation may become. Then scan Window Scenarios for Pressure Δ, Restriction ratio, Fatigue risk, and Status, not just bedtime.Coaching Plan after you understand the table. If you change Adaptation cadence, watch how Priority and Timing shift even though the scenario math does not.Sleep Window Map or JSON only after the table makes sense. If the result area disappears at any point, restore a valid Fixed wake time; the page will not build scenarios until it can parse that field.The best first pass is the one you can compare with a sleep diary a week later.
Start with Recommended Sleep Window, but do not stop there. A high value in Projected SE does not automatically mean the plan is comfortable, sustainable, or safe. Read the bedtime, Goal Gap, Pressure Δ, and the first Coaching Plan action together.
The best verification step is outside the calculator: compare the chosen window with actual diary sleep efficiency and daytime sleepiness after several nights. This tool can show how a planned window relates to baseline sleep arithmetic, but not whether the plan is tolerated well in daily life.
Above target means the row is at least 2 points over goal. That can support holding the window, but it does not by itself justify an aggressive bedtime.On target and Near target are the rows most worth comparing side by side, because one step often changes bedtime more than it changes clinical practicality.Below target means the candidate window is more than 4 points under goal. In this calculator, that usually means the window is longer than your baseline sleep supports for the chosen target.Enter 5.2 hours for Baseline total sleep time, 06:45 for Fixed wake time, 90 for Sleep efficiency goal, 4.5 hours to 8 hours for the window range, and a 15-minute step. The calculator recommends a 5h 45m window with a 01:00 bedtime.
In that row, Projected SE is 90.4%, Goal Gap is +0.4%, and Status is On target. Pressure Δ is +33 minutes, so the recommendation is actually a little longer than baseline sleep rather than more restrictive.
That is a strong first-pass result because the arithmetic, bedtime, and label agree.
With the default values of 6.1 hours, 07:00, and an 85% goal, the Window Scenarios table shows 7h 15m at 84.1% with Status On target, 7h 30m at 81.3% with Status Near target, and 7h 45m at 78.7% with Status Below target.
Even so, the summary recommends 6h at 01:00. The reason is the package rule: the goal-aligned row must land within 0.5 percentage point of the goal or the script falls back to the baseline-snapped row.
Use this pattern as a reminder that the recommendation rule and the row-status bands are related, but they are not the same decision layer.
A common failure path is entering a baseline such as 6.0 hours and an 85% goal, then clearing Fixed wake time. When that field is blank, the page cannot build candidate windows from wake time back to bedtime.
The symptom is that Recommended Sleep Window, Window Scenarios, Coaching Plan, and Sleep Window Map all disappear together. Re-entering a valid time such as 07:00 restores the rows immediately.
If the page suddenly looks empty, check the wake-time field first.
Projected SE go above 100%?Because the formula reuses baseline total sleep time and divides it by the candidate window. If the candidate window is shorter than baseline sleep time, the ratio can exceed 100%. Here that is a planning signal about a very tight window, not a physiological measurement.
Adaptation cadence change the recommended window?No. The scenario grid, recommendation rule, and bedtime math stay the same. Adaptation cadence changes coaching priority scores and review timing in Coaching Plan.
High rows in Fatigue risk even when I set a lower Max restriction?Max restriction limits which rows can be recommended, not which rows appear in Window Scenarios. The table still shows the full candidate range so you can see what more aggressive windows would imply.
The package does not define a tool-specific upload path or server-side calculation step. The sleep-window math, charting, and structured output generation all run in the page.
The most common cause is an empty or invalid Fixed wake time. The page only renders results when it can parse that field and generate at least one candidate window.
Use this calculator to frame a sleep-window discussion, not to self-clear a demanding restriction plan. If daytime alertness drops, driving or machinery work becomes risky, or you have comorbid conditions that make sleep restriction harder to use safely, treat the output as a prompt for clinician review rather than as a stand-alone schedule.