Caffeine and sleep
How Long Before Bed Should You Stop Drinking Coffee?
For a regular cup of coffee, the best current evidence says to finish it about 9 hours before bed. A 2023 meta-analysis of 24 studies estimated that a coffee of about 107 mg should be drunk at least 8.8 hours before bedtime to avoid losing sleep, and a stronger 217 mg dose at least 13.2 hours before [2]. So if you go to bed at 11 p.m., a mid-afternoon latte is already pushing it.
What the research found
For years the standard advice was "no caffeine for 6 hours before bed." Surprisingly few studies had tested it until 2013, when researchers at Henry Ford Hospital in Detroit gave volunteers 400 mg of caffeine in pill form, about two to three 12-ounce cups of coffee by the FDA's reckoning [4]. They took it at bedtime, 3 hours before or 6 hours before, and wore a sleep monitor at home. All three timings disrupted sleep compared with a placebo. Even at 6 hours, total sleep fell by more than an hour [1].
The authors read that as support for a 6-hour minimum for substantial doses [1]. Notice the word minimum. Six hours is where they stopped testing, not where the effect stopped.
The 2023 meta-analysis pooled 24 studies to get a sharper picture. On average, caffeine cut total sleep by about 45 minutes and sleep efficiency by 7%. It added about 9 minutes to the time it took to fall asleep and 12 minutes of extra wake time during the night. Deep sleep shrank as well [2]. Working back from those effects, the researchers produced the 8.8-hour and 13.2-hour cut-offs, depending on dose [2].
"But I can fall asleep after coffee"
Plenty of people can drink an espresso after dinner and be asleep by 11. That doesn't mean the caffeine did nothing. In the 2013 study, the sleep monitor picked up the loss of sleep when caffeine was taken 6 hours before bed, while people's own sleep diaries showed a smaller dip that did not reach statistical significance [1]. You can lose the best part of an hour and barely notice.
The quality of sleep shifts too. Caffeine reduces the amount and share of deep sleep, the stage linked to feeling refreshed the next day [2][3]. As one sleep physician quoted by the Sleep Foundation puts it, even if you can fall asleep after caffeine, you may not be sleeping as deeply [3]. If you wake up unrefreshed and drink coffee late, the two may be connected. A different puzzle is feeling tired right after coffee, which we cover in why coffee can make you sleepy.
Cut-off times by drink
The meta-analysis gave figures for only two doses, so the table uses them as brackets. Caffeine amounts are the FDA's typical ranges for a 12-ounce serving [4].
| Drink (12 fl oz) | Typical caffeine | Closest research cut-off |
|---|---|---|
| Green tea | About 37 mg | Well under a coffee; 8.8 hours is a generous margin |
| Black tea | About 71 mg | Under a 107 mg coffee; 8.8 hours covers it |
| Caffeinated soft drink | 23 to 83 mg | 8.8 hours covers it |
| Regular brewed coffee | 113 to 247 mg | At least 8.8 hours; nearer 13 for a strong cup |
| Energy drink | 41 to 246 mg | Check the label; up to about 13 hours for the strongest |
A pre-workout serving of about 217 mg was the study's high-dose example, with its 13.2-hour cut-off [2]. Remember that doses add up. Two mugs of coffee at noon count as one big dose for your evening.
Fast and slow caffeine processors
These cut-offs are averages, and people differ a lot. Caffeine's half-life, the time your body takes to clear half of it, ranges from about 2 to 12 hours depending on the person [3]. That spread explains why one friend sleeps fine after a 4 p.m. coffee and another is wired at midnight.
Much of it comes down to the liver. One enzyme, CYP1A2, handles about 95% of the caffeine you drink, and common genetic variations change how fast it works [5]. Age, sex hormones, liver disease, diet, smoking and some medications all affect clearance as well [5]. Smoking can cut caffeine's half-life by up to half, while in later pregnancy it roughly doubles [3]. If you know caffeine hits you hard or lasts a long time, set your cut-off earlier than the averages suggest. The FDA also notes that how sensitive people are to caffeine, and how fast they eliminate it, varies widely [4].
Turning your bedtime into a cut-off time
The math is simple: take your usual bedtime and subtract the hours for your drink. In bed by 10 p.m.? Finish a regular coffee by about 1:10 p.m., 8.8 hours earlier. An 11 p.m. bedtime moves that to about 2:10 p.m., and midnight to about 3:10 p.m. A 217 mg pre-workout drink before an 11 p.m. bedtime would need to go down by about 9:50 a.m., 13.2 hours earlier.
The CDC's own sleep advice keeps it short: avoid caffeine in the afternoon or evening [6]. If you want a number based on your own drinks rather than an average cup, the caffeine calculator estimates how much is still in your system at bedtime. The same cut-off applies to the coffee you drink before a caffeine nap, even though you sleep right after it.
If you have cut caffeine back and still struggle to fall asleep or stay asleep for weeks at a time, the cause may be something else. Persistent insomnia is worth raising with a doctor.
Frequently asked questions
Is 8 hours enough time between coffee and bed?
For a single regular cup, it is close. The 2023 meta-analysis estimated that a coffee of about 107 mg should be finished at least 8.8 hours before bedtime to avoid a drop in total sleep [2]. The Sleep Foundation recommends at least 8 hours as a rule of thumb [3]. A larger or stronger drink needs more time.
Can I drink coffee and still sleep?
Many people can fall asleep after coffee, but that does not mean their sleep is unaffected. In a study of 400 mg taken 6 hours before bed, a sleep monitor recorded over an hour less sleep, while people's own sleep diaries showed a smaller loss that was not statistically significant [1]. Caffeine also reduces deep sleep on average [2].
What time should I stop drinking coffee?
Count back about 9 hours from your usual bedtime for a regular cup. If you go to bed at 11 p.m., that means finishing coffee by about 2 p.m. [2]. If you drink strong coffee or energy drinks, move the cut-off earlier, and if you are sensitive to caffeine, earlier still [3].
Does decaf affect sleep?
Decaf is low in caffeine but not free of it. The FDA says decaf coffee typically has 2 to 15 mg in an 8-ounce cup [4], compared with well over 100 mg in a regular brewed coffee. For most people an evening decaf is unlikely to matter much, but if you are very sensitive, it can add up over several cups.
Sources
- Drake C, Roehrs T, Shambroom J, Roth T, Journal of Clinical Sleep Medicine. Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed (2013)
- Gardiner C et al., Sleep Medicine Reviews. The effect of caffeine on subsequent sleep: A systematic review and meta-analysis (2023)
- Sleep Foundation. Caffeine and Sleep
- U.S. Food and Drug Administration. Spilling the Beans: How Much Caffeine is Too Much?
- Nehlig A, Pharmacological Reviews. Interindividual Differences in Caffeine Metabolism and Factors Driving Caffeine Consumption (2018)
- Centers for Disease Control and Prevention. About Sleep
This page is general information, not medical advice. Sleep needs vary; if you have persistent insomnia, loud snoring, pauses in breathing or daytime sleepiness that affects your safety, see a doctor.