How Many Hours Before Bed Should You Stop Drinking Coffee?
Yash Arya
Founder, Soja · Built the circadian algorithm powering these guides
Last updated July 14, 2026
TL;DR
Stop caffeine 8–10 hours before your target bedtime. Caffeine has a half-life of roughly 5–6 hours, so a 200mg coffee at 2pm still leaves about 100mg in your system at 8pm and 50mg at 2am. For an 11pm bedtime, that means your last coffee by 1–3pm. Even caffeine taken 6 hours before bed cuts objectively measured sleep by over an hour, and evening caffeine delays your circadian clock by ~40 minutes on top of that.
The number, and where it comes from
Stop drinking coffee 8–10 hours before you want to be asleep. For an 11pm bedtime, that is a hard cutoff around 1–3pm. This is not a round-number rule of thumb — it falls straight out of the pharmacology, so it is worth working through rather than just asserting.
Caffeine is cleared with a half-life of roughly 5–6 hours in a healthy adult. Half-life means the time for your body to eliminate half of what is present. So the dose does not vanish when the buzz fades — it decays slowly, halving, then halving again. Call it six hours and follow one cup through an evening.
You drink a 200mg coffee — a large drip or a double-shot latte — at 2pm. By 8pm, one half-life later, about 100mg is still circulating. By 2am, two half-lives in, about 50mg remains. That 50mg is roughly the caffeine in a can of Coke, and it is in your bloodstream at the exact point in the night when your deepest, most restorative sleep is supposed to be happening. The 2pm coffee is still on the job at midnight.
That 5–6 hour figure is a population average, and the spread is large. The measured range runs from about 1.5 to 9.5 hours between individuals. Two variables dominate: the CYP1A2 gene, which encodes the liver enzyme responsible for ~95% of caffeine clearance, and estrogen-based oral contraceptives, which inhibit that same enzyme and can nearly double caffeine's half-life. If you are on the pill, your afternoon coffee may still be working at breakfast. Smoking pushes the other way, roughly halving clearance.
Why blocking sleep pressure is not the same as removing it
The reason caffeine keeps you awake explains why it wrecks the sleep you do get. Caffeine is an adenosine receptor antagonist. Adenosine is the molecule that builds up in your brain the longer you are awake — it is the chemical signal for sleep pressure, the growing sense of tiredness across a day. Caffeine does not clear adenosine. It plugs the receptors so the adenosine already present cannot dock and cannot register.
So the sleep debt is still accruing underneath. You feel alert, but the pressure is piling up behind a blocked door. When the caffeine finally clears, all of that accumulated adenosine floods receptors at once — which is the afternoon crash, and, if you drank too late, a 2am problem. Caffeine borrows wakefulness; it does not create it.
This is also why "I fall asleep fine after coffee" is a trap. You can be tired enough to sleep through a meaningful dose and still have that dose degrade the sleep itself.
Does afternoon coffee actually affect sleep if I fall asleep fine?
Yes — and the damage is mostly invisible from the inside. In a controlled trial, a 400mg dose taken 0, 3, or even 6 hours before bed all significantly disrupted sleep versus placebo. At the 6-hour mark, objectively measured total sleep time fell by more than an hour, in people who did not necessarily notice.
The subtler cost is to sleep quality, not just quantity. Caffeine specifically suppresses slow-wave sleep — the deep, delta-wave stage that drives physical recovery, immune function, growth hormone release, and memory consolidation. Studies using EEG find delta activity cut by 20–30% even when total sleep time and subjective restfulness look normal. A meta-analysis of controlled trials found caffeine reduced total sleep time by about 45 minutes and sleep efficiency by 7% on average.
That is the disconnect that fools people: you clock eight hours and feel you slept, but the architecture underneath is shallower. You paid full time and got a discount night.
The part most articles miss: caffeine moves your clock
Insomnia is the well-known cost. The underappreciated one is that evening caffeine does not just block sleep — it shifts the circadian clock itself. In a double-blind study, a dose equivalent to a double espresso taken 3 hours before bedtime produced a ~40-minute phase delay of the melatonin rhythm. For scale, that was nearly half the delay caused by three hours of bright evening light, one of the most potent clock-shifting signals known.
A phase delay means your entire biological night slides later. Your melatonin onset, your temperature minimum, your natural wake time — all nudged toward a later schedule. The mechanism runs through the same adenosine/cAMP signaling inside the clock cells, and it lengthens the clock's intrinsic period.
This is why caffeine timing matters far beyond insomnia. If you are fighting jet lag, recovering from an all-nighter, or resetting a shifted schedule, a late coffee actively pushes your clock in the wrong direction — deeper into delay — right when you are trying to advance it earlier. Caffeine is not a neutral background variable in a circadian reset. It is a phase-shifting drug, and after noon it usually shifts you the wrong way.
The rule to actually follow
Set a hard caffeine cutoff 8–10 hours before your target bedtime. Ten hours if you are caffeine-sensitive, on oral contraceptives, or trying to fix a disrupted schedule; eight if you are a fast metabolizer with no sleep complaints. For a midnight bedtime, that is a last coffee between 2 and 4pm. Anchor the cutoff to the bedtime you want, not the one you currently have.
There is one legitimate exception, and it is the case Soja is built around: using caffeine on purpose to stay awake until a target bedtime — pushing through the morning after a red-eye, or holding off an evening crash so you sleep at the right local hour. There, a strategically timed dose helps you land on the correct schedule. But treat it as a scheduled intervention with a clear last-dose time, not a free action. A recovery plan that says "in bed at 11pm" and a 5pm espresso are working against each other.
How to time caffeine so it doesn't wreck your sleep
- 1
Fix your target bedtime first
Decide the time you want to be asleep — the schedule you are aiming for, not the one you have drifted into. Every caffeine decision keys off this number.
- 2
Subtract 8–10 hours to set your cutoff
That is your hard last-call for caffeine. 11pm bedtime → last coffee by 1–3pm. Use the earlier end (10 hours out) if you take oral contraceptives, are caffeine-sensitive, or are repairing a disrupted schedule.
- 3
Count all sources, not just coffee
Tea, cola, energy drinks, pre-workout, dark chocolate, and many pain relievers carry caffeine. A pre-workout at 6pm can hold 200mg-plus. Tally the total dose, not the number of coffees.
- 4
Front-load your intake
Put your caffeine in the morning window, when the wake-up demand is real and there is a full day to clear it. Because of the half-life, a morning dose is mostly gone by night; the same dose after lunch is not.
- 5
Use caffeine deliberately to reach a bedtime, then stop
If you are staying awake to hit a target sleep time — after a red-eye or an all-nighter — a timed dose is a tool. Give it a firm last-dose time that still respects the 8–10 hour rule against your target bedtime.
- 6
Never chase lost sleep with more caffeine
Caffeine blocks the adenosine signal, it does not clear the debt. Doubling down builds a bigger crash and a worse night. Recover with light timing and a real sleep window instead.
- 7
If you're resetting your clock, cut off even earlier
Evening caffeine delays your circadian phase by up to ~40 minutes — the wrong direction for jet lag or a schedule advance. During a reset, stop caffeine by early afternoon so it isn't fighting your light and melatonin timing.
Get your personalised recovery plan
Answer 4 questions about your sleep disruption. Get a day-by-day plan with exact timing for light, caffeine, melatonin, and sleep.
Build my plan↗Free · No account needed · Takes 2 minutes
Frequently asked questions
How many hours before bed should I stop drinking coffee?
Eight to ten hours before your target bedtime. For an 11pm bedtime that means a hard cutoff around 1–3pm. The math: caffeine's half-life is about 5–6 hours, so a 200mg coffee at 2pm still leaves roughly 100mg in you at 8pm and 50mg at 2am. Go to the earlier, 10-hour cutoff if you are caffeine-sensitive or on oral contraceptives.
What is caffeine's half-life and why does it matter for sleep?
Roughly 5–6 hours in a healthy adult, meaning your body eliminates half the dose in that time and half again over the next. So caffeine decays slowly rather than wearing off cleanly. A meaningful fraction of an afternoon coffee is still circulating at bedtime, which is why timing — not just quantity — determines whether it reaches your sleep.
Does afternoon coffee affect sleep even if I fall asleep fine?
Yes. In controlled trials, caffeine taken 6 hours before bed reduced objectively measured sleep by over an hour, often without the person noticing. It also specifically suppresses slow-wave (deep) sleep, cutting delta-wave activity 20–30% even when total sleep time looks normal. Falling asleep fine does not mean the sleep was undamaged.
Why do oral contraceptives change how long caffeine lasts?
The pill's estrogen inhibits CYP1A2, the liver enzyme that clears about 95% of your caffeine. With that enzyme slowed, caffeine's half-life can nearly double — so an afternoon coffee may still be active the next morning. If you take oral contraceptives, use an earlier cutoff, closer to 10 hours before bed.
Can caffeine make jet lag worse?
It can. Beyond keeping you awake, evening caffeine delays your circadian clock — a double-espresso dose 3 hours before bed shifted the melatonin rhythm about 40 minutes later, nearly half the effect of bright evening light. That pushes your clock in the wrong direction when you are trying to advance it. Used deliberately in the morning to hold a target schedule, though, caffeine can help.
Does decaf still affect sleep?
Much less, but not zero. A cup of decaf typically carries 2–15mg of caffeine versus 80–200mg in regular coffee. For most people an evening decaf is fine; if you are highly caffeine-sensitive or on oral contraceptives, even small amounts can add up, so treat it cautiously near bedtime.
If I already had coffee too late, what should I do?
Don't add more caffeine to push through — you will only deepen the eventual crash. Keep light low in the evening, keep your wake time fixed the next morning, and get bright light on waking to protect your clock. One late coffee is a single degraded night, not a reset; the fix is protecting the following morning's light signal.
Related guides
References
- Burke TM, Markwald RR, McHill AW, Chinoy ED, Snider JA, Bessman SC, Jung CM, O'Neill JS, Wright KP Jr (2015). Effects of caffeine on the human circadian clock in vivo and in vitro. Science Translational Medicine.
- 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.
- Gardiner C, Weakley J, Burke LM, Roach GD, Sargent C, Maniar N, Townshend A, Halson SL (2023). The effect of caffeine on subsequent sleep: A systematic review and meta-analysis. Sleep Medicine Reviews.
- 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.