Circadian rhythm

Caffeine and sleep: how late is too late?

The research gives a clearer answer than the usual 'no coffee after 2 pm' rule, and the real answer depends on how much you drink.

Botanical engraving of a coffee branch with glossy leaves, flowers and berries, printed white on Prussian blue.
Coffea arabica, from Köhler’s Medizinal-Pflanzen (Germany, late nineteenth century). Public domain, via Wikimedia Commons, printed here as a cyanotype.

In brief

  • Across 24 studies, caffeine reduced total sleep by an average of 45 minutes and cut deep sleep, with the effect growing the closer to bedtime it was taken.
  • Dose matters as much as timing. In a 2025 trial, 100 mg had no measurable effect even 4 hours before bed, while 400 mg disrupted sleep when taken within 12 hours.
  • A meta-analysis suggests finishing a typical coffee (about 107 mg) at least 8.8 hours before bed, and a large pre-workout serving (about 217 mg) at least 13.2 hours before.
  • Caffeine's half-life is usually quoted at 3 to 6 hours, but it varies widely: smoking speeds clearance, while oestrogen-containing contraceptives slow it.
  • You may not notice the damage. People in the 2025 trial often didn't perceive the effects that sleep recordings picked up.

“No coffee after 2 pm” is the most common caffeine rule, and it is not a bad one. But it treats a single espresso and a 300 mg energy drink the same, and it ignores the fact that some people clear caffeine twice as fast as others. The research now lets us do better.

What caffeine does at night

Caffeine works mainly by blocking adenosine, a messenger that builds up while you are awake and contributes to sleep pressure 1. Blocking it does not remove your need for sleep. It hides the signal, which is why caffeine can leave you lying awake while still tired. Brain recordings show the effect directly: caffeine reduces the slow-wave activity that characterises deep sleep 2.

Caffeine also shifts the body clock. In a placebo-controlled laboratory study, a dose equivalent to a double espresso three hours before bed delayed the melatonin rhythm by about 40 minutes 3. So a late coffee can make it harder to fall asleep tonight and nudge your clock later for tomorrow.

How long it stays in your system

Caffeine levels typically peak 30 to 120 minutes after you drink it, and its half-life is usually quoted at 3 to 6 hours 4. After one half-life, half the dose is still circulating; after two, a quarter.

0 25 50 75 100 mg 14:0016:0018:0020:0022:0000:0002:0004:0006:00 Bedtime 23:00 ≈32 mg
Modelled caffeine remaining after one standard coffee (about 107 mg) at 14:00. The line assumes a 5-hour half-life; the band spans 3 to 7 hours. At 23:00 roughly 32 mg would remain (range 14–45 mg). This is a simplified model for illustration, not a measurement. Source: Half-life range from Mort & Kruse 2008 and Abernethy & Todd 1985; serving size from Gardiner et al. 2023.

Those averages hide a lot of variation. One liver enzyme, CYP1A2, handles about 95% of caffeine metabolism, and common genetic differences in it make clearance highly variable between people 5. Age, liver function, some medications and smoking all change it too. A systematic analysis of 141 pharmacokinetic studies confirmed that smoking speeds caffeine clearance while oral contraceptive use slows it 6. In one classic study, women using low-dose oestrogen-containing contraceptives had an average caffeine half-life of 7.9 hours, against 5.4 hours in women who were not 7.

What the trials show

The overall effect

The best summary comes from a 2023 meta-analysis of 24 studies 8. On average, caffeine:

MeasureAverage effect of caffeine
Total sleep time45 minutes less
Sleep efficiency7% lower
Time to fall asleep9 minutes longer
Time awake after first falling asleep12 minutes longer
Deep sleep (N3/N4)11.4 minutes less
Light sleep (N1)6.1 minutes more

An earlier systematic review reached the same conclusions and added two important caveats: older adults may be more sensitive, and most studies were done in young men in Western countries, which limits how far the findings generalise 2.

Six hours is not always enough

In a placebo-controlled study, people took 400 mg of caffeine at bedtime, three hours before, or six hours before. All three timings significantly disturbed sleep compared with placebo, measured both by questionnaires and a home sleep monitor. The authors concluded that substantial caffeine should be avoided for at least six hours before bed 9.

400 mg is a large single dose, nearly twice the standard pre-workout serving used in the meta-analysis below, but some products and stacked drinks get there.

Dose changes everything

A 2025 randomised crossover trial tested two doses at three different times in 23 young men 10. Each took placebo, 100 mg or 400 mg of caffeine 12, 8 or 4 hours before bed, with in-home sleep recordings:

  • 100 mg had no significant effect on objective or self-reported sleep at any timing, including 4 hours before bed.
  • 400 mg delayed sleep onset and altered sleep architecture when taken within 12 hours of bed, and caused more fragmented sleep within 8 hours.

The study also found a gap between measured and perceived sleep: the recordings picked up effects that participants did not report, which the authors took to mean people struggle to judge how caffeine affects their sleep. “Caffeine doesn’t affect me” is not reliable evidence.

Even morning caffeine?

One small study gave nine healthy men 200 mg of caffeine at 7:10 am. That night their sleep efficiency and total sleep time were lower than after placebo, even though caffeine levels in their saliva had fallen to a low level by bedtime 1. It is a single, small study, but it suggests the most sensitive people may be affected by morning caffeine too.

So when should you stop?

The 2023 meta-analysis translated its findings into cut-off times to avoid losing total sleep 8:

What you drinkSuggested minimum gap before bedIf bedtime is 23:00, finish by
A standard coffee (about 107 mg per 250 ml)8.8 hoursabout 14:10
A standard pre-workout serving (about 217.5 mg)13.2 hoursabout 09:50

The 2025 trial suggests a smaller dose, around 100 mg, may be fine closer to bed for many people 10. These two findings fit together better than they first appear: the meta-analysis averaged many studies, many with larger doses, while the trial isolated dose and timing directly. Both point to the same principle. The bigger the dose, the earlier it needs to be.

A sensible approach for most people:

  1. Keep large doses in the morning. Anything over about 200 mg in one go belongs early in the day.
  2. Treat the afternoon as small-doses-only. One ordinary coffee in the early afternoon is probably fine for most people. A large energy drink is not.
  3. Adjust for your biology. If you are older, use oestrogen-containing contraception, or simply know you are sensitive, move your cut-off earlier.
  4. Test it on yourself. Try two weeks with your usual pattern and two weeks with an earlier cut-off, and compare how long you take to fall asleep and how rested you feel.

Our caffeine cut-off calculator applies these research figures to your own bedtime and drinks, and shows a range rather than a single number, because nobody’s metabolism is average.

Who is more sensitive?

Some people genuinely tolerate late coffee better than others. A variant in the gene for the adenosine A2A receptor, caffeine’s main target in the brain, was more common in people who described themselves as caffeine-sensitive, and it affected how strongly caffeine changed their sleep EEG 11. Variation in the enzyme that metabolises caffeine adds a second layer 5.

That said, consumer genetic tests are not validated for setting personal caffeine cut-offs. Your own sleep is a better guide, provided you remember that you may not notice the effects without measuring.

Our take

Caffeine is one of the clearest cases in sleep science: the effect is real, it scales with dose and timing, and it is easy to underestimate. You do not need to give up coffee. Move the big doses early, keep the afternoon light, and if you are struggling with sleep, make caffeine timing the first thing you test.

If you take L-theanine alongside caffeine, see our L-theanine article for what it does and doesn’t do for sleep.

Verdicts

The claims this article tested, and how well the research supports each one. How we rate evidence.

  • Caffeine taken within several hours of bedtime reduces sleep.

    Strong

    A 2023 meta-analysis of 24 studies (Gardiner 2023), an earlier systematic review (Clark 2017) and randomised trials (Drake 2013; Gardiner 2025) agree, with dose- and timing-dependent effects.

  • A single 100 mg dose taken 4 or more hours before bed has no meaningful effect on sleep.

    Limited

    Supported by one well-designed randomised crossover trial, but in only 23 young men with moderate habitual intake (Gardiner 2025). It may not apply to sensitive or older people.

  • Caffeine in the morning can still affect sleep that night.

    Limited

    One small controlled study of nine men found 200 mg at 7 am reduced sleep efficiency and total sleep that night (Landolt 1995). It has not been widely replicated.

  • Genetic differences change how strongly caffeine affects your sleep.

    Limited

    A variant in the adenosine A2A receptor gene was linked to caffeine sensitivity and sleep effects (Rétey 2007), and enzyme variants alter metabolism (Nehlig 2018). Consumer genetic tests are not validated for setting personal cut-offs.

References

  1. Landolt HP, Werth E, Borbély AA, Dijk DJ (1995). Caffeine intake (200 mg) in the morning affects human sleep and EEG power spectra at night. Brain Research. Controlled trial, n=9. DOI PubMed
  2. Clark I, Landolt HP (2017). Coffee, caffeine, and sleep: a systematic review of epidemiological studies and randomized controlled trials. Sleep Medicine Reviews. Systematic review. DOI PubMed
  3. Burke TM, Markwald RR, McHill AW, et al. (2015). Effects of caffeine on the human circadian clock in vivo and in vitro. Science Translational Medicine. Placebo-controlled laboratory study. DOI PubMed
  4. Mort JR, Kruse HR (2008). Timing of blood pressure measurement related to caffeine consumption. Annals of Pharmacotherapy. Review. DOI PubMed
  5. Nehlig A (2018). Interindividual differences in caffeine metabolism and factors driving caffeine consumption. Pharmacological Reviews. Review. DOI PubMed
  6. Grzegorzewski J, Bartsch F, Köller A, König M (2021). Pharmacokinetics of caffeine: a systematic analysis of reported data for application in metabolic phenotyping and liver function testing. Frontiers in Pharmacology. Systematic analysis of 141 publications. DOI PubMed
  7. Abernethy DR, Todd EL (1985). Impairment of caffeine clearance by chronic use of low-dose oestrogen-containing oral contraceptives. European Journal of Clinical Pharmacology. Pharmacokinetic study. DOI PubMed
  8. Gardiner C, Weakley J, Burke LM, et al. (2023). The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Medicine Reviews. Meta-analysis of 24 studies. DOI PubMed
  9. Drake C, Roehrs T, Shambroom J, Roth T (2013). Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine. Placebo-controlled trial. DOI PubMed
  10. Gardiner CL, Weakley J, Burke LM, et al. (2025). Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep. Randomised crossover trial, n=23. DOI PubMed
  11. Rétey JV, Adam M, Khatami R, et al. (2007). A genetic variation in the adenosine A2A receptor gene (ADORA2A) contributes to individual sensitivity to caffeine effects on sleep. Clinical Pharmacology & Therapeutics. Genetic and sleep EEG study. DOI PubMed

Article history

  • : first published.