Sleep
September 21, 2026
6 min read
The last coffee you can get away with is earlier than you think.
The five-hour half-life everyone repeats is a rounded average that was never a fact about you. Here is what the timing trials measured, and what it does to a 2 PM cup.
The short answer
Earlier than the folklore suggests: a 2023 systematic review and meta-analysis of 24 studies derived a cutoff of 8.8 hours before bed for a standard 250 mL coffee, and a randomised trial found that 400 mg taken six hours before bedtime still cost more than an hour of sleep. There is no single clock time because caffeine half-life is a distribution rather than a constant, measured at an average of 3.4 hours across a range of 2 to 5 in one saliva study of 25 adults, and moved by CYP1A2 variation, smoking, oral contraceptives and pregnancy.
The five-hour rule is a rounded average, not your number
Almost every answer to this question opens the same way. Caffeine has a half-life of about five hours, so halve the dose, halve it again, and pick a time. The arithmetic is fine. The number going into it is the problem.
We went looking for the measurement behind that five. What is there is a range. When half-lives were measured directly, from saliva samples, the mean across 25 adult men and non-pregnant women was 3.4 hours, with a range running from 2 to 5. In 57 pregnant women in the same study the mean was 8.3 hours and the range ran from 3 to 16. One value in that spread clears an afternoon coffee before dinner. Another still has a quarter of it in you at midnight.
What decides where you sit is mostly one enzyme. CYP1A2 metabolises about 95 percent of the caffeine you swallow, and the gene for it is polymorphic, so two people with the same cup do not get the same evening. An analysis pooling 141 published studies, 4,714 individuals in all, found the pattern holding across more than fifty years of data: smokers clear caffeine faster and run shorter half-lives, people taking oral contraceptives clear it slower. Pregnancy slows it further.
Which is why the published advice never agreed with itself. The authors of the best-known timing trial noted that recommendations on when to stop ranged from 4 to 11 hours before bed, and named half-life variability as the reason.
A half-life is not a number you have. It is a distribution you live somewhere inside.
The trial everyone cites, and what it actually did
In 2013 a group at Henry Ford Hospital in Detroit ran the study the whole question rests on. Twelve healthy normal sleepers, six women and six men, aged 19 to 48, slept at home on their own schedules. On separate nights they took 400 mg of caffeine in pill form at bedtime, three hours before bedtime, or six hours before bedtime, with identical placebos at the other two times and one night of placebo throughout. Randomised, double-blind, double-dummy, in a Latin square. Sleep was recorded with a portable monitor.
All three timings disturbed sleep relative to placebo. The finding that travelled was the last one: even taken six hours before bed, caffeine reduced sleep by more than an hour. The authors kept their own recommendation modest, that afternoon caffeine should at a minimum be restricted to before 17:00.
Two things about that study belong in the same paragraph as its result. Twelve people is twelve people, and 400 mg is a large dose, closer to two strong coffees than to the cup most people are asking about. One of the four authors worked for the company that made the sleep monitor used to measure the outcome. None of that makes the finding wrong. It makes it one careful result rather than a law.
The meta-analysis put a number on it, and the number is 8.8 hours
A 2023 systematic review and meta-analysis in Sleep Medicine Reviews is the closest thing the field has to an answer. Pooling 24 studies, it found caffeine cut total sleep time by 45 minutes and sleep efficiency by 7 percent, added 9 minutes to sleep onset and 12 minutes of wake after sleep onset, increased light N1 sleep by 6.1 minutes and reduced deep N3 and N4 sleep by 11.4 minutes.
Then it did what nobody had done and derived cutoffs. To avoid losing total sleep time, a standard 250 mL coffee at 107 mg should be drunk at least 8.8 hours before bed. A standard serve of pre-workout supplement at 217.5 mg needs 13.2 hours.
Put a clock on that. If you go to bed at 22:30, 8.8 hours earlier is about 13:40. That is the uncomfortable part of the answer: on the best current estimate the 2 PM coffee is already inside the window, and the 4 PM one is not a borderline case.
That cutoff is an estimate, not a measurement. It is modelled from pooled averages rather than tested as a rule in a trial, and the literature it pools is narrow. An earlier systematic review of the same field noted that most studies were run in male adults in Western countries, which is a real limit on who 8.8 hours describes.
You do not know your dose
Every cutoff above is stated per milligram, and the milligrams are where the arithmetic quietly comes apart. When analysts measured caffeine in specialty coffees bought from shops, caffeinated servings ran from 58 to 259 mg, and the mean for a brewed 16 ounce cup was 188 mg.
The stranger finding is the one worth keeping. The same drink, ordered from the same outlet on six consecutive days, ranged from 259 to 564 mg.
Not six different drinks. The same one, more than doubling.
So the cutoff is calculated for 107 mg, and there is no reliable way to know whether what you drank was that or three times it. That is an argument for leaving yourself margin, not for precision.
It is not only what is left in you, it is what it does to the clock
Half-life arithmetic assumes the only thing that matters is how much caffeine is still circulating at lights out. There is evidence that this is incomplete.
In a within-subject study running about 49 days, five healthy participants took the caffeine equivalent of a double espresso three hours before habitual bedtime. It delayed their circadian melatonin rhythm by about 40 minutes, roughly half the delay produced by three hours of bright light at around 3000 lux beginning at bedtime.
Five people is a very small study and it needs replicating at scale. It is also the first demonstration that caffeine moves the human clock rather than only masking sleepiness, and the cell work in the same paper traced that to adenosine receptor signalling.
An older result points the same way and is genuinely disputed. In 1995, nine healthy men took 200 mg at 07:10 and went to bed at 23:00, roughly sixteen hours later, with saliva caffeine down to 3 micromoles per litre by lights out. Sleep efficiency and total sleep time were still significantly reduced. The Detroit group later characterised that study as producing minimal effects on standard sleep parameters. Both readings survive contact with the data, and the honest summary is that a morning dose probably does something small to that night, with no agreement on how small.
What none of this tells you
It does not tell you that caffeine wakes you at 3 AM. The meta-analysis found 12 extra minutes of wake after sleep onset, spread across the night, and less deep sleep. That is a shallower, more interrupted night, not an appointment. If you surface at the same hour most nights, caffeine may be making the night easier to surface from, but the waking itself is a different question with its own literature.
It does not tell you to quit. None of these studies tested abstinence against timing, and nothing above is an argument against coffee.
What it supports is narrower: move the last one earlier, and leave more room than the popular arithmetic suggests.
And it gives you no way out once the cup is drunk. Clearance is enzymatic and no trial shows that water, food or exercise hurries it. What is still available on that particular night is not the chemistry. It is the second problem, the one where lying there calculating how little sleep you are going to get is itself the thing keeping you awake.
Common questions
Is 2 pm too late to have a cup of coffee?
On the best current estimate, possibly yes. A 2023 meta-analysis of 24 studies derived a cutoff of 8.8 hours before bed for a standard 250 mL coffee, which puts the line near 13:40 if you sleep at 22:30. That figure is modelled from pooled averages rather than tested as a rule, and half-life varies enough between people that your own line may sit hours either side of it.
Is 4pm too late to drink caffeine?
For most people, yes. A randomised trial found 400 mg taken six hours before bed still cost more than an hour of sleep, and its authors recommended stopping before 17:00 at a minimum. The pooled estimate is earlier still. Dose matters as much as the hour, so a single espresso at 16:00 is not the same question as a large brewed coffee.
How long does caffeine keep you awake at night?
Longer than it keeps you feeling awake. Measured half-lives in one saliva study averaged 3.4 hours across 25 adults, with a range of 2 to 5, so a real fraction of an afternoon dose is still in you at bedtime. Pooled trial data show caffeine cuts total sleep time by about 45 minutes and deep sleep by about 11, whether or not you notice it.
Can caffeine affect sleep 12 hours later?
The evidence points that way and it is contested. Nine healthy men given 200 mg at 07:10 slept worse that night, roughly sixteen hours later, with significantly reduced sleep efficiency and total sleep time. A later paper described the same result as minimal. The honest reading is that a morning dose probably does something small to that night, and the size is unsettled.
What is the 2 hour coffee rule?
It is folklore, and it comes in two versions: wait about two hours after waking for your first coffee, or stop about two hours before bed. Neither has a trial behind it. The second one matters here, because the timing research points to a far longer gap. The trial evidence supports six hours at a minimum and the pooled estimate is closer to nine.
How long will 200mg of caffeine keep you awake?
There is no fixed answer, and that is the useful part. At the measured average half-life of 3.4 hours, roughly 50 mg of a 200 mg dose is still there seven hours later. At the slow end of the adult range, far more. Sleep studies find effects at levels well below what people can feel, so the absence of a buzz is not evidence it has gone.
How to get rid of caffeine insomnia?
You cannot speed it up. Clearance is enzymatic, handled almost entirely by one liver enzyme, and no trial shows that water, food or exercise shortens it. What does respond is the second problem: lying there calculating how little sleep is left keeps you awake long after the caffeine stops mattering. Write the night off, and move the cutoff earlier tomorrow.
Is 3.30 too late for coffee?
For most bedtimes, yes, on both available estimates. Half past three is seven hours before a 22:30 bedtime, which sits inside the six-hour window where a trial measured more than an hour of lost sleep, and inside the 8.8-hour cutoff the meta-analysis derived. If you sleep at midnight or later, 15:30 is closer to the edge than inside it.
How long until caffeine is 100% out of your system?
Never exactly, because half-lives approach zero without arriving. The practical benchmark is five half-lives, at which about 97 percent has gone: roughly 17 hours at the measured average of 3.4 hours, and considerably longer at the slow end. Smoking shortens the half-life, oral contraceptives lengthen it, and pregnancy lengthens it a great deal more.
What to do if you've had caffeine and can't sleep?
Accept the chemistry and work on the rest. Nothing has been shown to clear caffeine faster, so what is left to you is arousal: keep the room dark, stay off the clock, and give attention something dull to hold instead of trying to force sleep. Then move tomorrow's last cup earlier, which is the only change the evidence actually supports.
References
- [1] Caffeine at 0, 3 and 6 hours before bed, measured at home. 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, 9(11), 1195-1200. Link
- [2] Systematic review and meta-analysis deriving the 8.8-hour cutoff. Gardiner, C., Weakley, J., Burke, L. M., Roach, G. D., Sargent, C., Maniar, N., Townshend, A., Halson, S. L. (2023). The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Medicine Reviews, 69, 101764. Link
- [3] Dose and timing response, and the limits of the evidence base. Clark, I., Landolt, H. P. (2017). Coffee, caffeine, and sleep: a systematic review of epidemiological studies and randomized controlled trials. Sleep Medicine Reviews, 31, 70-78. Link
- [4] Measured caffeine half-lives, non-pregnant and pregnant. Knutti, R., Rothweiler, H., Schlatter, C. (1981). Effect of pregnancy on the pharmacokinetics of caffeine. European Journal of Clinical Pharmacology, 21(2), 121-126. Link
- [5] CYP1A2, ADORA2A and why metabolism differs between people. Nehlig, A. (2018). Interindividual differences in caffeine metabolism and factors driving caffeine consumption. Pharmacological Reviews, 70(2), 384-411. Link
- [6] Pooled pharmacokinetics: smoking, oral contraceptives and clearance. Grzegorzewski, J., Bartsch, F., Koller, A., Konig, M. (2021). Pharmacokinetics of caffeine: a systematic analysis of reported data for application in metabolic phenotyping and liver function testing. Frontiers in Pharmacology, 12, 752826. Link
- [7] How much caffeine is actually in a shop-bought coffee. McCusker, R. R., Goldberger, B. A., Cone, E. J. (2003). Caffeine content of specialty coffees. Journal of Analytical Toxicology, 27(7), 520-522. Link
- [8] Evening caffeine delays the circadian melatonin rhythm. Burke, T. M., Markwald, R. R., McHill, A. W., Chinoy, E. D., Snider, J. A., Bessman, S. C., Jung, C. M., O'Neill, J. S., Wright, K. P. Jr (2015). Effects of caffeine on the human circadian clock in vivo and in vitro. Science Translational Medicine, 7(305), 305ra146. Link
- [9] A morning dose, measured at night. Landolt, H. P., Werth, E., Borbely, A. A., Dijk, D. J. (1995). Caffeine intake (200 mg) in the morning affects human sleep and EEG power spectra at night. Brain Research, 675(1-2), 67-74. Link
About the author
Stillee
Stillee is an evidence-based mindfulness app for panic, sleep, and the rest of being human at 3 AM. The Journal carries the same voice and the same standard for citations.
The practices behind this writing live in Stillee, including the full 8-week MBSR course. See Premium plans