Caffeine

Caffeine and sleep: why the afternoon cup costs you

Sourced explainer · By Jeffrey Dietrich, PhD · ~7 min read

You can drink a coffee at 3 p.m., feel totally normal by bedtime, and still sleep worse for it. Caffeine's effect on sleep is quiet, lingering, and easy to miss — which is exactly why it's so costly. Here's what the research actually shows, and how long before bed to stop.

How caffeine blocks sleep pressure

Through the day, a molecule called adenosine builds up in your brain. The more it accumulates, the sleepier you feel — it's your body's running tab of sleep pressure. Caffeine works by sliding into adenosine's receptors and blocking them, so the "I'm tired" signal never lands.1 Useful at 8 a.m. The problem is that caffeine doesn't erase the sleep pressure — it just hides it. The adenosine is still there, waiting. And the caffeine doing the hiding sticks around far longer than most people assume.

The half-life is the whole story

Caffeine has a half-life of about five hours — meaning five hours after a cup, half the caffeine is still circulating.2 Run the clock forward on a 2 p.m. coffee:

TimeCaffeine still in your system
2 p.m. (one cup, ~95 mg)~95 mg
7 p.m.~48 mg
12 a.m.~24 mg
5 a.m.~12 mg

A quarter of the dose is still active at midnight — enough to blunt your sleep even if you drift off without trouble. The half-life also explains why the damage is cumulative: a second and third cup don't reset the clock, they stack on top of what's already there.

What the bed-timing study found

The cleanest evidence comes from a controlled trial by Drake and colleagues. They gave healthy sleepers 400 mg of caffeine — roughly two to three cups — at 0, 3, or 6 hours before bed, with sleep measured objectively. Even the 6-hours-before dose reduced total sleep time by more than an hour, and participants frequently failed to notice the effect themselves.3 That last part is the trap: self-report is unreliable here, so "I sleep fine after coffee" is not evidence that you do.

The takeaway: you can fall asleep fine and still lose sleep. The cost shows up as less deep sleep and shorter total sleep — not necessarily as lying awake.

It's not just falling asleep — it's the sleep itself

Falling asleep is the part people watch. The more important damage is to the architecture of the night. A systematic review of controlled studies found that caffeine reliably lengthens the time it takes to fall asleep, cuts total sleep time and sleep efficiency, increases light stage-1 sleep and awakenings, and — the big one — suppresses deep slow-wave sleep, the restorative stage that does the heavy repair work.4 Other analyses report delayed REM as well.5 So even a full eight hours in bed can leave you under-restored. For a fuller picture of what the molecule is doing system-wide, see what caffeine does to your body.

The afternoon dip — and why a nap beats a cup

Most people reach for the afternoon coffee because of a real circadian dip in alertness around 2–4 p.m. The trouble is that the cup you drink to fix a 3 p.m. slump is still 25% active at midnight. A short nap clears the same dip without seeding sleep loss eight hours later. If you need the cup, the question isn't whether to drink it — it's how late you can afford to.

Tolerance and the sleep-debt loop

Here's the loop that keeps people stuck: caffeine costs you deep sleep, so you wake up under-restored, so you reach for more caffeine, often later in the day — which costs you more sleep again. Tolerance makes it worse, because the dose that used to lift you now barely registers, nudging intake up. The afternoon cup isn't fixing the tiredness caffeine helped create the night before; it's refinancing it at a higher rate.

Who pays the most

The enzyme that clears caffeine (CYP1A2) varies 5–6× between people.2 If you're a slow metabolizer — or simply older, since the sleeping brain tends to grow more caffeine-sensitive with age4 — that afternoon cup lingers much longer and costs much more sleep. Pregnancy, oral contraceptives, and not smoking all slow clearance further. The practical implication: generic "stop by 2 p.m." advice is a starting point, not a universal rule. Watch your own nights.

If you are…Practical cutoff before bed
An average metabolizer~8 hours
Slow metabolizer / older / sensitive10–12 hours
Drinking a large or double doseAllow extra — the tail scales with the dose

What to do about it

The simplest fix is timing: stop caffeine 8–10 hours before bed, earlier if you're sensitive.5 But that cuts off exactly the afternoon-and-evening window when a lot of people most want a lift. The other levers: keep total daily intake moderate, front-load it earlier, and don't chase a bad night with a bigger afternoon dose. If you want the cup without the long tail, that points to a different chemistry — covered next.

The paraxanthine angle: clears faster

When your liver processes caffeine, the main thing it produces is paraxanthine (Px) — the compound your body makes from caffeine, and the one that carries a portion of caffeine's alertness. Taken on its own, paraxanthine appears to clear the body somewhat faster than caffeine, with a reported half-life in the rough neighborhood of ~3 hours versus caffeine's ~5.6 A shorter tail is precisely what the evening problem calls for: the lift when you want it, less of it left at midnight. How that works mechanistically is covered in how paraxanthine works. And if your fix so far has been switching to decaf, note that decaf can still wake you up for reasons that have nothing to do with caffeine.

Common questions

How many hours before bed should I stop drinking caffeine?

A common guideline is to stop 8–10 hours before bed. Caffeine's half-life is about 5 hours, and in a controlled trial even a 400 mg dose taken 6 hours before bedtime cut total sleep by more than an hour. Slow metabolizers and older adults should allow even longer.

Does caffeine in the afternoon affect sleep even if I fall asleep fine?

Yes. You can fall asleep and still get worse sleep — caffeine reduces deep (slow-wave) sleep and total sleep time even when it does not stop you from dozing off, and even when you do not feel "wired."

How long before bed to stop caffeine if I am sensitive?

If you are a slow metabolizer, older, pregnant, or simply notice caffeine hits you hard, treat 8 hours as a floor, not a target. Sensitive people may need to cut off caffeine by early afternoon — roughly 10–12 hours before bed.

Does caffeine affect sleep quality or just falling asleep?

Both, but quality is the part people miss. Reviews of controlled studies show caffeine lengthens the time to fall asleep, lowers sleep efficiency, increases light sleep and night-time awakenings, and suppresses deep slow-wave sleep — so even a full night can leave you under-restored.

Why does caffeine affect some people more than others?

The liver enzyme that clears caffeine (CYP1A2) varies 5–6× between people. Slow metabolizers keep caffeine in their system far longer, so the same cup hits their sleep much harder. Sensitivity also tends to rise with age.

Does decaf or paraxanthine help if caffeine is wrecking my sleep?

Decaf removes the caffeine — and the lift along with it. Paraxanthine, the compound your body makes from caffeine, clears the body faster than caffeine does, which is why it is being explored as an evening-friendlier alternative. This page is information, not medical advice.

* These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure, or prevent any disease. Content on this page is informational and not a substitute for medical advice; talk to a clinician about caffeine and your health.

References
  1. Adenosine-receptor antagonism as caffeine's mechanism; older adults more sensitive. Clark I, Landolt HP. Sleep Medicine Reviews (2017). PubMed 26899133.
  2. Caffeine plasma half-life ~5 h (reported range ~1.5–10 h); CYP1A2 ~5–6× interindividual variation. Pharmacokinetics of Caffeine: A Systematic Analysis of Reported Data. Frontiers in Pharmacology (2021). PMC8914174.
  3. 400 mg caffeine at 0, 3, or 6 h before bed; 6-h dose cut total sleep by >1 h. Drake C, Roehrs T, Shambroom J, Roth T. J Clin Sleep Med (2013). PMC3805807 · PubMed 24235903.
  4. Caffeine reduces sleep efficiency, total/slow-wave sleep, increases stage-1 and awakenings; age sensitivity. Clark I, Landolt HP. Sleep Medicine Reviews 31:70–78 (2017). PubMed 26899133.
  5. Cutoff-timing guidance and effects on REM/deep sleep. Sleep Foundation, "How Long Does It Take for Caffeine to Wear Off?". sleepfoundation.org.
  6. Paraxanthine as primary caffeine metabolite; reported human half-life ~3 h vs caffeine ~5 h. Paraxanthine overview, ScienceDirect Topics. sciencedirect.com.

Keep going: caffeine, explained · caffeine half-life · why decaf still wakes you up · best coffee for sleep