"No coffee after 2pm" gets repeated so often it sounds like a law of physics. It isn't. It's a rough population-wide guess dressed up as a rule, and it skips the two things that decide whether your afternoon coffee wrecks your sleep: how much caffeine you drank, and how fast your particular body clears it.
What the newest dose-and-timing trial found
A 2024 randomized, placebo-controlled crossover trial gave healthy adults either 100mg or 400mg of caffeine (or a placebo) at 4, 8, or 12 hours before bedtime, then measured their sleep with polysomnography, the same setup used in sleep labs.1 The 100mg dose, roughly one regular coffee, barely moved the needle at any timing tested, even taken just 4 hours before bed. The 400mg dose (about four coffees, or one large energy drink) was a different story. Taken 4 hours before bed, it added 14 minutes to how long it took to fall asleep, cut total sleep by about 50 minutes, and trimmed nearly 30 minutes off deep sleep.
The strange part is what happened at 12 hours out. That same 400mg dose, consumed a full 12 hours before bedtime, was still cutting deep sleep by around 20 minutes. Not the same size effect as taking it right before bed, but not nothing either. Dose mattered more than the clock.
Dose mattered more than the clock.
Why your liver is the real clock
The reason a single cutoff time can't work for everyone is genetic, not a matter of willpower. One liver enzyme, CYP1A2, handles the large majority of caffeine clearance, and a common variant in the gene that codes for it splits people into two rough groups.2 "Fast" metabolizers clear caffeine with a half-life of around 2 to 4 hours. "Slow" metabolizers, roughly half the population, can take 8 hours or longer to clear the same half. That's not a small gap. It means the same 3pm coffee can be fully cleared from a fast metabolizer's system by bedtime, and still be half-present in a slow metabolizer's bloodstream at midnight.
A dose-based cutoff beats a clock-based one
Count the dose, not the cup. A 250ml drip coffee runs around 95mg of caffeine, an espresso shot around 63mg, and a can of energy drink can be anywhere from 80mg to over 300mg depending on the brand. Two "coffees" can mean two very different caffeine loads.
Treat 400mg as the number to watch, especially late in the day. The trial found 100mg barely registers even close to bedtime, while 400mg disrupts sleep at every timing tested, including 12 hours out. If your afternoon and evening drinks add up past that, timing alone won't save you.
If wired evenings or jittery afternoons are already a pattern for you, assume you're a slow metabolizer. You don't need a genetic test to act on this. Being unusually sensitive to a normal dose is itself the signal.
Stack your doses mentally, not just your cups. A coffee at 10am and another at 2pm isn't two small, separate doses by the time evening rolls around. To your bloodstream, it's closer to one larger one that hasn't finished clearing.
If you're already sensitive to caffeine
None of this means caffeine is fine for everyone right up until bedtime. It means the flat "2pm" rule is a population average standing in for a number that depends on your dose and your particular biology. If one afternoon coffee already keeps you staring at the ceiling, trust that pattern over any generic clock-based cutoff. Your own sleep is a better sensor than a rule of thumb ever will be.
Sources
-
Gardiner, C., Weakley, J., Burke, L.M., et al. (2024). "Dose and timing effects of caffeine on subsequent sleep: a randomised clinical crossover trial." Sleep, 48(4), zsae230. doi.org/10.1093/sleep/zsae230 ↩
-
Nehlig, A. (2018). "Interindividual Differences in Caffeine Metabolism and Factors Driving Caffeine Consumption." Pharmacological Reviews, 70(2), 384-411. doi.org/10.1124/pr.117.014407 ↩