What happens when you sleep?
Every night you drop through light sleep into deep sleep, surface into REM and dream, about four to six times before morning. Scrub through a night, watch the brain waves change, flip the switch that stops you acting out dreams, and see why coffee only hides sleepiness.
▶ Play with it · Read the 60-second explainer
- Sleep comes in stages. Sleep is not one blank state. You move from drowsy N1 into N2 light sleep, down into N3 deep sleep, and then into REM sleep, when the eyes dart and dreams are vivid. One pass takes roughly 90 minutes (about 70 to 120 is normal), so an adult has about four to six cycles a night.
- Early deep, late REM. Deep sleep is packed into the first few cycles of the night. REM periods grow longer towards morning. Cutting a night short by waking early costs you mostly REM sleep.
- Each stage has its own brain waves. Scalp electrodes (EEG) show alpha waves when you relax with closed eyes, slower theta in N1, spindles and K-complexes in N2, big slow delta waves in N3, and small fast wake-like activity in REM.
- Paralysed while you dream. During REM a brainstem circuit switches off most muscles. This atonia stops dreams becoming movements. Dreams are most vivid in REM but happen in other stages too, and why we dream is still debated.
- Two forces make you sleepy. Sleep pressure builds the longer you are awake, with adenosine as one signal of it. A body clock in the suprachiasmatic nucleus adds a 24-hour rhythm and lets melatonin rise in the dark. Caffeine blocks adenosine receptors, so it hides sleepiness rather than removing it.
- Sleep does real work. In mice, the space between brain cells widens during sleep and fluid flushes waste away faster. Sleep helps store memories, and growth hormone surges early in deep sleep. The CDC recommends at least 7 hours a night for adults, and more for children and teenagers.
| Term | Meaning |
|---|---|
| Hypnogram | A chart of sleep stages through the night, with deeper stages drawn lower. |
| Sleep cycle | One pass through the non-REM stages and a REM period, roughly 90 minutes. |
| N3 deep sleep | The deepest non-REM stage, with large slow delta waves; also called slow-wave sleep. |
| REM sleep | Rapid eye movement sleep: an active, wake-like brain in a still body, with vivid dreams. |
| EEG | Recording the brain's electrical activity with electrodes on the scalp. |
| Sleep spindle | A short burst of fast brain waves typical of N2 sleep. |
| Muscle atonia | The loss of muscle tone in REM that keeps you from acting out dreams. |
| Adenosine | A molecule that builds up while you are awake and promotes sleepiness; caffeine blocks its receptors. |
| Circadian rhythm | The body's roughly 24-hour cycle, set by a master clock in the suprachiasmatic nucleus. |
| Glymphatic system | A fluid system that washes waste from the brain, found in mice to work faster during sleep. |
From Aristotle’s fumes to the brain’s night-time wash: how people found out what happens when we sleep.
- 350 BCE · Aristotle asks what sleep is for (Aristotle, Athens, Greece)
- 1924 · Hans Berger records human brain waves (Hans Berger, Jena, Germany)
- 1937 · All-night brain recordings reveal stages of sleep (Alfred Loomis, E. Newton Harvey and G. Hobart, Tuxedo Park, New York, USA)
- 1953 · REM sleep is discovered (Eugene Aserinsky and Nathaniel Kleitman, University of Chicago, USA)
- 1957 · The nightly sleep cycle is mapped (William Dement and Nathaniel Kleitman, University of Chicago, USA)
- 1959 · Paradoxical sleep: an active brain in a still body (Michel Jouvet and colleagues, Lyon, France)
- 1982 · Two processes decide when we sleep (Alexander Borbély, University of Zurich, Switzerland)
- 1984 · The period gene is isolated (Jeffrey Hall, Michael Rosbash and Michael Young, Brandeis University and Rockefeller University, USA)
The full story, with 41 moments, charts, people and 50 sources: glassbox.how/e/sleepclear/history. The data lives in history.json.
Made with the Glassbox studio from this box's storyboard (window.glassbox.director). Free to reuse under CC BY 4.0.
| File | What | Size |
|---|---|---|
glassbox/slide-1…10.jpg |
Instagram carousel | 1080×1350 |
glassbox/thumb.jpg |
YouTube thumbnail | 1280×720 |
glassbox/cover.jpg |
Share card and repo social preview | 1200×630 |
This box has no accounts and no ads, and it ships its own fonts and libraries. When you run it yourself it sends nothing anywhere. On glassbox.how, the site's /bar.js also loads Glassbox's analytics: Google Analytics to count visits (it asks first in the EU, UK and Switzerland, and stays off when your browser sends Global Privacy Control or Do Not Track) and ClickTrust to detect bots.
It remembers a few things in your own browser only, and never sends them anywhere:
| Browser storage key | What it holds |
|---|---|
sleepclear.v1 |
Which chapters you have opened, your best quiz scores, and sound on or off. |
Exactly what each one sees is at glassbox.how/privacy.
- Code: MIT. Use it, change it, ship it.
- Explanations, text, images and videos (
glassbox.json,glassbox/): CC BY 4.0. Credit “Glassbox, glassbox.how/e/sleepclear”. - Third-party parts keep their own licences: three.js (MIT), Geist, Instrument Serif (SIL OFL 1.1).
- The Glassbox name and logo aren't covered by either licence. See the terms.
Found a mistake? Open an issue. Corrections happen in public.
It's plain HTML, CSS and JavaScript. No build step and no dependencies. Run locally, it contacts no other website.
python3 -m http.server 8000Three.js and the fonts ship in vendor/ and fonts/, so it also works offline.
Then open http://localhost:8000.
| File | What |
|---|---|
index.html, css/app.css |
The page and its styles |
js/app.js, js/stage.js, js/ui.js, js/kit.js |
The shared Glassbox 3D engine: chapters, 3D stage, controls, quiz, video director |
js/chapters/*.js |
One file per chapter: the 3D model, controls, text, key terms, quiz and video scenes |
glassbox.json |
Title, question, explainer beats, key terms, browser storage and credits shown on glassbox.how |
reel in each chapter |
The storyboard the Glassbox studio records into short videos |
glassbox/ |
The published video, slides, thumbnail and post copy |
fonts/, vendor/three/ |
Self-hosted Geist and Instrument Serif (SIL OFL 1.1) and three.js (MIT) |




