Sleep Calculator

Work backward from a wake-up time or forward from a bedtime, in 90-minute cycles, with an adjustable buffer for how long you take to fall asleep.

🌐 Español

🔒 Private by design: everything is generated locally in your browser and never uploaded to any server.

Cycles, not hours

The reason a sleep calculator exists at all is that total hours are the wrong variable. Seven and a half hours of sleep and eight hours of sleep are not simply a bit different in quantity; if the alarm lands in the middle of a cycle rather than at the end of one, the extra half hour can leave you feeling worse.

The widely cited model puts a full cycle at about ninety minutes. So the useful question is not how many hours you can get but how many complete cycles fit before the alarm, which is why the report gives you four options rather than one number.

Six cycles is nine hours, five is seven and a half, four is six, and three is four and a half. They are listed most sleep first, because that is usually the preferred option, and the shorter ones are there because sometimes it is already one in the morning.

Working out tonight’s bedtime

  1. Leave What do you want to calculate? on the wake-up option to work backward from an alarm, or switch to the other to work forward from a bedtime.
  2. Enter the hour into Hour, 24-hour clock 0-23 (your wake-up time in “wake up at” mode, or your bedtime in “going to bed” mode). For a seven in the morning alarm, that is 7.
  3. Enter the minutes into Minute, 0-59 (same time as the Hour field above).
  4. Adjust Minutes it typically takes you to fall asleep after getting into bed if fifteen is not right for you. The range is 0 to 60.
  5. In the going-to-bed mode only, you can tick the current time checkbox to use your device clock instead of the two fields.
  6. Click Sleep Calculator, then read the four suggested times.
  7. Copy to clipboard takes the whole report. Generate more returns you to the fields.

The two number fields are shared between the modes. In one mode they mean your wake-up time and in the other your bedtime, which is what their labels spell out, and the mode you are not using simply does not read them.

A worked example, both ways

Ask for a seven in the morning wake-up with the default fifteen minute buffer. The report gives 9:45 in the evening for six cycles, quarter past eleven for five, quarter to one for four and quarter past two for three. The first two are labelled as falling on the previous night, because from the point of view of a seven o’clock alarm they do.

Now go the other way. Enter half past eleven at night as a bedtime with the same buffer, and the wake-up times come back as quarter to nine, quarter past seven, quarter to six and quarter past four, all labelled as the next day.

Notice the buffer in both. The bedtime suggestions are times to be in bed, not times to be asleep, and the wake-up suggestions already account for the fifteen minutes you will spend getting there.

Midnight is where these calculators break

Almost every arithmetic bug in a tool like this lives at the day boundary. Subtract nine and a quarter hours from a morning wake-up and you land on the previous evening; add nine hours to a late bedtime and you land on the following morning.

The approach here is to avoid dates entirely. Every time is held as a plain count of minutes since midnight, and the wraparound is done with modular arithmetic that is explicitly written to behave correctly for negative values, which is the exact place naive code goes wrong. Alongside the wrapped clock time, the calculation also reports whether the result fell on the previous day, the same day or the next one.

That day label is not decoration. A bare bedtime of 9:45 with no indication that it means the previous evening is genuinely ambiguous, and the report never leaves you to work it out.

There is exactly one place the real clock is consulted, which is the current time checkbox. It reads your device’s local hour and minute once, and everything after that is plain integer arithmetic.

What the model is and is not

Ninety minutes is an average drawn from sleep research and repeated by every calculator of this kind. It is not a measurement of your own cycles, which vary between people, across a night, and with age. Early cycles tend to be shorter than later ones.

The report carries that caveat itself rather than leaving it to this page, along with a plain statement that none of this is medical advice. The honest use is comparative. If you are choosing between going to bed now and finishing one more episode, knowing that the later option costs you a whole cycle rather than forty minutes is a genuinely useful thing to know.

For persistent sleep problems, a calculator is not the answer.

Tools for the rest of the routine

Binaural Beats Generator and White Noise Generator both run in a tab overnight if background sound helps you get to sleep. Online Timer covers a nap rather than a night.

For the other side of the day, Golden Hour Calculator works out sunrise and sunset at your location, which is the input most people actually want when adjusting a sleep schedule. Heart Rate Zone Calculator and BMI Calculator are the neighbouring health estimates, each with its own honest caveats. The rest is on the calculators hub.

See it in action

Screenshot of the Sleep Calculator tool with What do you want to calculate? set to I want to wake up at a certain time, show me bedtimes, Hour, 24-hour clock 0-23 (your wake-up time in "wake up at" mode, or your bedtime in "going to bed" mode) set to 7
Sleep Calculator mid-process: What do you want to calculate? set to I want to wake up at a certain time, show me bedtimes, Hour, 24-hour clock 0-23 (your wake-up time in "wake up at" mode, or your bedtime in "going to bed" mode) set to 7.
Screenshot of the Sleep Calculator result screen showing the generated output “=== SLEEP CYCLE CALCULATOR === Mode: I want to w…”
The finished result: the generated output “=== SLEEP CYCLE CALCULATOR === Mode: I want to w…”. The download link is a local blob URL — the file never leaves your device.

Frequently asked questions

Why does the report show four times instead of one?

Because there is no single right answer. Each line is a different number of complete cycles, six, five, four and three, which is nine, seven and a half, six and four and a half hours of sleep. They are listed with the most sleep first. Pick whichever fits the night you are actually having rather than the one you wish you were having.

What is the buffer for?

The time between getting into bed and actually falling asleep, which is real and which most cycle calculators either ignore or bury. Fifteen minutes is the default because that sits in the middle of the range sleep sources commonly cite. It is added to every calculation, so a bedtime suggestion is the time to get into bed rather than the time to be asleep.

Why does the clock use a 24-hour input but show a 12-hour result?

The input avoids an extra morning or afternoon dropdown, since a single 0 to 23 field is unambiguous with no second control. The output uses the 12-hour form because that is how most people read a bedtime, with an explicit note when the time falls on the previous night or the following day.

Does it handle crossing midnight?

Yes, in both directions, and it tells you which day the answer lands on. Waking at seven in the morning and working back six cycles gives a bedtime of quarter to ten the previous night, labelled as such. Going to bed at half past eleven and forward six cycles gives a wake-up at quarter to nine the next day. Every time value is handled as plain minutes since midnight with no date object involved, which is what keeps the wraparound reliable.

What does the current time checkbox do?

Reads your device's local clock once and uses it as the bedtime, ignoring the hour and minute fields entirely. It only applies in the going-to-bed mode, since using the current time as a target wake-up makes no sense. In the other mode it has no effect at all.

Is the 90-minute cycle a real number?

It is a widely cited average, not a measurement of you. Real cycle length varies between people, between nights, and with age, and it is not constant across a single night either. The report says so directly. Treat the four suggested times as a sensible way to choose between them, not as a precise prescription.

Is this medical advice?

No, and the report says that too. It is arithmetic on a popular heuristic. If you have ongoing trouble sleeping, or you are consistently tired despite adequate hours, that is a matter for a doctor or a sleep specialist rather than for a calculator.

Related tools