Caffeine and Sleep: How Late Can You Drink Coffee and Still Sleep Well?

Most people who drink coffee know not to have an espresso just before bed. Fewer realise how long caffeine keeps acting: in controlled studies, a large dose taken six hours before bedtime still cut sleep by more than an hour, and the people affected often did not notice. Here is what the evidence says about caffeine and sleep, and how to pick a sensible cut-off time.
How caffeine keeps you awake
While you are awake, a substance called adenosine slowly builds up in the brain and adds to the pressure to sleep. Caffeine works mainly by blocking adenosine receptors, so the signal of growing tiredness is muffled. That is why coffee feels helpful in the morning or after lunch, and also why it can make it harder to fall asleep, sleep deeply or stay asleep later on. Caffeine does not remove the underlying need for sleep; it hides it for a while.
How long caffeine stays in the body
The European Food Safety Authority (EFSA) gives the average half-life of caffeine in healthy adults as about four hours, with a range of roughly two to eight hours. The half-life is the time it takes the body to clear half of the caffeine consumed. EFSA notes that it varies with age, body weight, pregnancy, medication and liver health; in pregnancy it becomes several times longer.
In practice, this means a strong coffee at 3 p.m. can leave a meaningful amount of caffeine in circulation at 11 p.m., and much more in people who clear it slowly. Two people drinking the same cup at the same time can have very different nights.
What the studies show
Caffeine six hours before bed
In a frequently cited study, Drake and colleagues gave 12 healthy adults who normally slept well a 400 mg dose of caffeine (or a placebo) at bedtime, three hours before bedtime and six hours before bedtime, and measured their sleep at home (Journal of Clinical Sleep Medicine, 2013). All three caffeine timings significantly disturbed sleep compared with placebo. Even the dose taken six hours before bed reduced objectively measured total sleep time by more than an hour, according to the American Academy of Sleep Medicine's summary of the study, yet participants did not report the loss in their sleep diaries. The authors concluded that avoiding substantial caffeine for at least six hours before bedtime is advisable. The study was small and used a high dose, roughly equivalent to several mugs of filter coffee at once.
A 2023 meta-analysis
Gardiner and colleagues pooled 24 studies on caffeine and subsequent sleep (Sleep Medicine Reviews, 2023). On average, caffeine reduced total sleep time by about 45 minutes and sleep efficiency by 7%, increased the time taken to fall asleep by about 9 minutes, and increased time awake after first falling asleep by about 12 minutes. It also reduced deep sleep. Based on their models, the authors suggested that a cup of coffee containing about 107 mg of caffeine should be drunk at least 8.8 hours before bedtime to avoid a reduction in total sleep time, and a typical pre-workout supplement (about 217 mg) at least 13.2 hours before.
These figures are averages from controlled studies, mostly in young healthy adults, and individual sensitivity varies widely. But they point in a consistent direction: the effect of caffeine on sleep lasts much longer than the alert feeling does.
The official view
EFSA's 2015 scientific opinion on caffeine safety concluded that single doses up to 200 mg and habitual intakes up to 400 mg a day do not raise safety concerns for healthy non-pregnant adults, and set 200 mg a day as the limit in pregnancy. It also noted that doses of about 100 mg can affect sleep in some people, particularly when consumed close to bedtime. The US Food and Drug Administration similarly cites 400 mg a day as an amount not generally associated with negative effects for most adults, and lists insomnia and sleep disruption among the signs of having too much.
How much caffeine is in common drinks
| Drink | Typical caffeine | Source |
|---|---|---|
| Filter coffee, 200 ml | about 90 mg | EFSA |
| Espresso, 60 ml | about 80 mg | EFSA |
| Energy drink, 250 ml can | about 80 mg | EFSA |
| Tea, 220 ml cup | about 50 mg | EFSA |
| Cola, 355 ml can | about 40 mg | EFSA |
| Decaffeinated coffee, 8 fl oz (about 240 ml) | typically 2 to 15 mg | FDA |
Real amounts vary a lot with the beans, the brewing method and the size of the cup: a large café coffee can contain far more than a 200 ml filter coffee. Caffeine is also found in chocolate, some painkillers and cold remedies, and in "pre-workout" products, which can contain high doses. Check labels if you are trying to cut down.
Choosing your cut-off time
No single cut-off suits everyone, but the evidence supports a few practical rules:
- Count back from bedtime, not from the clock. If you go to bed at 11 p.m., the meta-analysis figure of about nine hours for a standard coffee suggests making your last cup around 2 p.m. If you go to bed at 10 p.m., aim for earlier.
- Allow more time for bigger doses. A large café coffee, an energy drink or a pre-workout supplement contains more caffeine and needs a longer gap.
- Do a two-week experiment. Move your last caffeinated drink earlier and keep a simple sleep diary: when you went to bed, roughly when you fell asleep, how often you woke and how rested you felt. People often underestimate caffeine's effect, as the 2013 study showed.
- Switch rather than stop. Decaffeinated coffee, herbal infusions or water in the afternoon keep the habit without most of the caffeine.
- Do not use caffeine to cover a sleep debt. If you rely on coffee to get through every afternoon, the underlying problem may be too little sleep. See how much sleep adults really need.
Caffeine is one of several things that shape sleep timing. Light is the strongest signal for the body clock: bright days and dim evenings help you feel sleepy at the right time, as explained in our guide to daylight and your body clock. Morning caffeine fits more comfortably with good sleep, a point covered in our science-based morning routine.
Who should be more careful
- Pregnant and breastfeeding people: EFSA's limit in pregnancy is 200 mg a day, and caffeine is cleared much more slowly during pregnancy. The FDA advises talking to a health professional about whether to limit caffeine.
- Children and teenagers: the FDA notes that medical experts advise against energy drinks for children and teens, and that too much caffeine can cause sleep problems in this age group.
- People with insomnia, anxiety or heart rhythm problems, and people taking medicines that interact with caffeine, should ask a doctor or pharmacist about how much is right for them.
In short
- Caffeine's half-life averages about four hours in healthy adults but ranges from about two to eight hours (EFSA).
- In a 2013 trial, 400 mg of caffeine taken six hours before bed still cut sleep by more than an hour.
- A 2023 meta-analysis suggests drinking a standard coffee at least 8.8 hours before bedtime.
- For many people, a last coffee in the early afternoon is a reasonable starting point; test what works for you.
This page is general information, not medical advice. If you have persistent trouble sleeping, are pregnant, or take regular medication, talk to a doctor or pharmacist about caffeine.
Sources
- European Food Safety Authority, Caffeine topic page; Scientific Opinion on the safety of caffeine, EFSA Journal 2015;13(5):4102; EFSA explains risk assessment: Caffeine (2015).
- Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine 2013;9(11):1195–1200.
- American Academy of Sleep Medicine, press release on the Drake et al. study (November 2013).
- Gardiner C, Weakley J, Burke LM, et al. The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Medicine Reviews 2023;69:101764.
- US Food and Drug Administration, Spilling the beans: how much caffeine is too much? (content current as of 28 August 2024).
SleepHow much sleep adults need
Not one magic number but a range: what sleep societies, the CDC and the NHS recommend.
SleepDaylight and your body clock
Bright days, dim evenings, dark nights: lighting a home for the circadian rhythm.
RoutinesA science-based morning routine
Wake time, daylight, movement and caffeine, plus viral tips without evidence.