Back to Blog

Sleep and Memory: Why Sleep Helps You Remember

How sleep and memory are linked, why all-nighters backfire before exams, whether naps help you learn, and a simple sleep plan for students in exam season.

Rohit SalujaFounder, Active Recalling12 min read
A tired student in glasses asleep with her head on a stack of books

Sleep and memory are tightly linked: sleep before learning prepares your brain to take in new information, and sleep after learning helps stabilize it so you can recall it days later. That's why cutting sleep to study more usually backfires. You lose some of what you studied and arrive at the next lesson less able to learn.

You don't need perfect sleep to do well. What helps most is regular, sufficient sleep across the term, short reviews timed around it, and not treating the night before an exam as extra study time.

This guide explains what sleep does for memory, what the studies on all-nighters and naps actually found, and gives you a sleep plan for exam season.

How are sleep and memory connected?

Memory has three stages: encoding (taking information in), consolidation (stabilizing it), and retrieval (getting it back out). Sleep matters for the first two.

While you study, your brain stores new material in a fragile form that depends heavily on the hippocampus. During sleep, especially deep slow-wave sleep early in the night, recently learned material is reactivated and gradually integrated into longer-term memory networks. REM sleep, which is more common later in the night, may help stabilize those changes. This is what researchers mean by memory consolidation during sleep.

A major 2013 review by Björn Rasch and Jan Born describes sleep as a brain state suited to consolidating memories, while being awake is suited to taking new ones in.

Two caveats. First, researchers still debate exactly which sleep stage does what, so treat claims like "REM is for skills, deep sleep is for facts" as rough guides, not rules. Second, sleep only consolidates what you encoded.

If you skimmed a chapter without understanding it, sleeping on it won't fix that. Sleep works best on material you actively practiced, such as with retrieval practice.

What happens to memory when you don't get enough sleep?

Short sleep hurts learning in two ways. You consolidate less of what you studied the day before, and you encode less of what you study today.

The encoding problem shows up even with partial sleep loss, not just all-nighters. In a 2018 study, 59 teenagers were randomly assigned to either 9 hours in bed or 5 hours in bed for five nights in a row. Then both groups studied a set of pictures.

To make sure tiredness on test day wasn't the reason for any difference, everyone had three nights of 9 hours in bed before the memory test. The sleep-restricted group still remembered significantly less. What you fail to take in while tired isn't recovered by sleeping in later.

Studies of real students point the same way:

  • Trading sleep for study backfired. In a diary study that followed 535 high school students over 14 days in each of three grades, on days when a student gave up sleep to study more than usual, they had more trouble understanding material in class the next day and were more likely to struggle on a test or assignment.
  • Consistency mattered. In a 2019 study of 88 college students in an introductory chemistry class who wore sleep trackers, longer, better-quality, and more consistent sleep went with better quiz and exam grades. Sleep measures accounted for nearly a quarter of the variation in performance. This was a correlation, so it doesn't prove sleep caused the grades, but it fits the lab evidence.

Is it better to sleep or pull an all-nighter before an exam?

Sleep. An all-nighter gives you a few extra hours with the material at the cost of the sleep that would help you retain it, and you take the exam tired. The diary study above found that sacrificing sleep for study made the next day worse, not better.

There's a reassuring twist in the chemistry study: sleep on the single night before a test was not related to the score. Sleep over the previous week and month was. So:

  • Don't plan an all-nighter. It's a bad trade.
  • Don't panic about one restless night. If nerves keep you awake before an exam, rest quietly. The sleep that counts most is the sleep you've been getting for weeks. If pre-exam nerves are a pattern for you, see our guide to managing test anxiety.
  • Fix the cause. All-nighters usually come from leaving everything to the end. Spacing your study over several weeks removes the need for one.

Do naps help you learn?

They can. In a 2019 study, 84 young adults spent several hours learning detailed facts about crabs and ants. Halfway through, each person spent one hour either napping, taking a break while watching a movie, or cramming the same material.

What they did in the hourRecall 30 minutes laterRecall 1 week later
NappedBetter than the break groupStill better than the break group
CrammedBetter than the break groupNo longer better than the break group
Took a breakBaselineBaseline

Napping and cramming weren't significantly different from each other at either test. The honest summary: an hour of sleep protected memory at least as well as an extra hour of study, and its advantage over a break lasted a week, while cramming's didn't.

How to use this:

  • Nap after learning, not instead of it. A nap helps consolidate what you just studied.
  • Keep naps earlier in the day so they don't delay your bedtime.
  • Skip naps if you have trouble sleeping at night. The NHS advises people with insomnia not to nap during the day.

Short breaks with your eyes closed also help between study blocks; our guide to study breaks covers what to do in them.

Should you study right before bed?

A short review before bed is a good idea. Starting a hard new topic at midnight is not.

The strongest evidence for timing your study around sleep comes from a 2016 study in Psychological Science. Forty people learned foreign vocabulary until they knew it perfectly, then relearned it 12 hours later. Half learned in the morning and relearned that evening. The other half learned in the evening, slept, and relearned the next morning.

The group that slept in between needed about half as much practice to relearn the words, and they remembered them better a week later and six months later.

That gives you a simple routine:

  1. Evening: spend 15–20 minutes recalling the day's material from memory: flashcards, a blank-page brain dump, or a few practice questions.
  2. Sleep at your normal time.
  3. Morning: spend 10 minutes retesting the same material before you start anything new. Whatever you miss goes back on tonight's list.

Our guide to the best time to study covers how to fit this around being an early bird or a night owl.

How much sleep do students need?

These are the recommendations the CDC lists, drawn from consensus statements by the American Academy of Sleep Medicine and the Sleep Research Society:

AgeRecommended sleep per day
13–17 years8–10 hours
18–60 years7 or more hours

Most students fall short during exam season, so treat these as targets to protect, not as luxuries. Habits that help, from CDC and NHS guidance:

  • Keep the same wake-up time every day, including weekends.
  • Turn off screens at least 30 minutes before bed (CDC).
  • Stop caffeine at least 6 hours before bed. That's the NHS cutoff; the CDC simply says to avoid caffeine in the afternoon and evening. For an 11 p.m. bedtime, that means no tea, coffee, or energy drinks after about 5 p.m. More on timing in our caffeine and studying guide.
  • Skip big meals and alcohol close to bedtime.
  • Keep your bedroom quiet, dark, and cool.

An exam-season sleep plan

Use this from about a month before your exams. It protects sleep without costing you study time, because spaced reviews do more per hour than late-night cramming.

WhenWhat to do
3–4 weeks outPick a wake-up time and keep it every day. Plan study sessions so no night has to be sacrificed.
Every study dayLearn new material earlier in the day. In the last hour before bed, do 15–20 minutes of recall on that day's material. Lights out on time.
Every morning10-minute retest of last night's material before anything new.
Final weekNo heavy new topics after dinner. Last caffeine at least 6 hours before bed. Timed practice papers in the daytime.
Night beforeLight review, pack your bag, sleep at your usual time. If you lie awake, rest and don't check your notes.
Between examsIf you have a free afternoon, review, then nap if it won't wreck your night's sleep.

For the study side of the same weeks, see how to prepare for exams.

When poor sleep needs more than better habits

Exam stress often disrupts sleep for a few nights, and that usually settles once exams end. The NHS advises seeing a doctor if changing your sleep habits hasn't helped, you've had trouble sleeping for months, or poor sleep is making it hard to cope with daily life. Doctors now rarely prescribe sleeping pills for insomnia; you're more likely to be offered cognitive behavioral therapy (CBT), in person or through an online program.

It's also worth getting checked if you're very sleepy during the day despite spending enough hours in bed, or if someone notices you snoring loudly or pausing your breathing in your sleep. Your campus or school health service is a good first stop. If stress is what keeps you awake, our guide to how stress affects learning has practical ways to bring it down.

Frequently asked questions

Is it better to sleep or study the night before an exam?

Sleep, after a short review. Students who give up sleep to study more than usual understand less in class the next day and struggle more on tests. Do 30–60 minutes of light review in the evening, then sleep at your normal time. One restless night isn't decisive, since sleep across the previous weeks predicts grades better than sleep on the night before.

How many hours of sleep should I get before an exam?

Aim for your normal amount: 8–10 hours for teens and 7 or more for adults, per the CDC. More useful than any single night is getting close to that every night for the weeks before the exam. In a study of college chemistry students, sleep over the previous week and month went with better grades, while the night before the test did not.

Does sleeping right after studying help memory?

Yes, especially for facts and vocabulary. Material learned shortly before sleep tends to be retained better than material followed by a long stretch awake. In one study, people who learned vocabulary in the evening, slept, and relearned it the next morning needed about half the practice and remembered more six months later than people who learned and relearned on the same day.

How long should a nap be to help learning?

In the best-known study comparing a nap with cramming, the nap lasted about an hour and protected memory for at least a week. Take naps earlier in the afternoon so they don't delay your bedtime. If naps leave you groggy or make it hard to fall asleep at night, skip them and protect your night-time sleep instead.

Can I make up for lost sleep at the weekend?

Not for learning. In a study of teenagers, five nights of 5 hours in bed impaired their ability to take in new material, and the deficit was still there after three nights of recovery sleep. Sleeping in can ease tiredness, but it doesn't restore what you failed to learn while sleep-deprived. A steady schedule all week works better.

Sources and further reading

Start with the primary research and official guidance below. Links open in a new tab so you can compare the evidence with the article.

  1. About sleep's role in memory

    Rasch & Born, Physiological Reviews, 2013

    Read source
  2. Memory encoding is impaired after multiple nights of partial sleep restriction

    Cousins, Sasmita & Chee, Journal of Sleep Research, 2018

    Read source
  3. To study or to sleep? The academic costs of extra studying at the expense of sleep

    Gillen-O'Neel, Huynh & Fuligni, Child Development, 2013

    Read source
  4. Sleep quality, duration, and consistency are associated with better academic performance in college students

    Okano et al., npj Science of Learning, 2019

    Read source
  5. The long-term memory benefits of a daytime nap compared with cramming

    Cousins et al., Sleep, 2019

    Read source
  6. Relearn faster and retain longer

    Mazza et al., Psychological Science, 2016

    Read source
  7. About Sleep

    Centers for Disease Control and Prevention, 2024

    Read source
  8. Insomnia

    NHS, 2024

    Read source