It's 4 p.m., you're fading, and you get an Americano to push through the last stretch. At midnight you're in bed, tired but wired, staring at the ceiling.
Or maybe you're the other type: "Coffee doesn't affect me, I fall asleep instantly." And yet somehow you're still short on sleep every day.
Both of these are the same story, and it's a chemistry story.
The half-life account
While you're awake, your brain keeps building adenosine — the sleepiness signal. Enough accumulates, you feel sleepy. Caffeine looks almost exactly like adenosine. It sits in adenosine's receptors without passing the signal on, like taping over a doorbell button: the sleepiness is still there, you just can't hear the bell.
The problem is how slowly it leaves. Caffeine's half-life is about 5 hours (individual range roughly 2–10). So:
- Cup at 2 p.m. → about half still circulating at 7 p.m.
- → about a quarter still there at midnight.
A quarter of a strong coffee at bedtime is not nothing. It's a pharmacological dose sitting on your doorbell.
The experiments are unforgiving
Drake 2013 gave participants 400 mg of caffeine (about two large Americanos) at 0, 3, or 6 hours before bed, and measured sleep with instruments rather than self-report. Even the 6-hours-before group lost more than an hour of total sleep — while the participants themselves reported noticing much less. Caveat: only 12 people, and a high dose.
Gardiner 2023 pooled 24 studies: caffeine cut total sleep by about 45 minutes on average. Their estimate for a normal cup (~100 mg): finish it at least 8.8 hours before bed. Sleep at 11 p.m.? That's a 2 p.m. cutoff.
This is why it's a rule and not a suggestion. On this one point, how you feel cannot be trusted.
Why "it doesn't affect me" is unreliable
Caffeine doesn't have to keep you awake to cost you. It changes the structure of sleep: slower to fall asleep, more light sleep, more awakenings during the night. People usually don't notice any of it — they wake up having lost an hour and rate their night as "fine."
There's real individual variation, and it's genetic. Caffeine is broken down mainly by a liver enzyme called CYP1A2, whose activity depends on your genes, smoking, oral contraceptives, pregnancy, and more. That's why one colleague drinks espresso at 9 p.m. and sleeps like a stone, and you don't.
What to do
- No caffeine after 2 p.m. (adjust earlier if you're a slow metabolizer or a light sleeper)
- Audit the hidden sources: strong tea, milk tea, cola, energy drinks, and some painkillers and cold medicines.
- Afternoon lift without caffeine: walk around the block, get a few minutes of sun, or switch to decaf. The walk is doing more for your alertness than the coffee was.
For programmers: a late coffee to hit a deadline is trading tomorrow's performance for tonight's alertness — and sleep debt compounds, which is the next entry in this series.
Honesty corner: how strong is this?
Grade B. A meta-analysis of 24 studies plus a controlled trial, both measuring sleep objectively. Why not A: the outcomes are sleep measures, not long-term health outcomes, and the key trial had a small sample and a high dose.
Limits worth stating: caffeine clears much more slowly during pregnancy — follow your doctor's advice on intake. People with heart rhythm problems or anxiety disorders are more sensitive and should be more conservative.
This is entry #4 of a series from a free, open-source, evidence-graded guide — 111 studies, every claim graded A–D, every action tagged do it / try it / know it / don't spend:
- GitHub (bilingual): DeepoMe/Awesome-Programmer-Longevity
- Mobile ebook: deepkang.com/ebook/ebook.html
Previous: Sitting Is Its Own Risk Factor, and Your Gym Hour Does Not Cancel It. Next: sleep debt is compound interest — why you can't repay a week of short nights with one long lie-in.
Health education, not medical advice. If you have a medical condition or take medication, consult a physician before changing anything.









