"I can drink coffee right before bed and still sleep fine."
If you've ever said that, the science disagrees — and probably your sleep tracker does too. The reason late caffeine wrecks sleep without you noticing is a property called half-life. This post explains it without the chemistry-textbook detour.
What "half-life" actually means
Caffeine's half-life in healthy adults is roughly 5 hours (range: 3–7 hours depending on individual genetics, age, pregnancy, liver function, and concurrent medications like SSRIs or oral contraceptives).
Half-life means: after one half-life has passed, half of the caffeine you ingested is still in your bloodstream. After two half-lives, a quarter is still there. After three, an eighth.
So if you drink a single shot of espresso (~80 mg of caffeine) at 3:00 PM, here's what your bloodstream caffeine looks like at bedtime:
| Time | Caffeine remaining (mg) | |---|---| | 3:00 PM | 80 (peak) | | 8:00 PM | 40 (one half-life later) | | 1:00 AM | 20 (two half-lives) | | 6:00 AM | 10 (three) |
At 11 PM bedtime, you still have ~25 mg circulating — about a third of a cup of coffee's worth. That's enough to noticeably reduce deep sleep duration in most people, even if you can fall asleep.
Why "I sleep fine on caffeine" is usually wrong
Two reasons:
1. Falling asleep ≠ sleeping well. Studies measuring polysomnography (the gold-standard sleep tracking) consistently show that caffeine taken within 6 hours of bedtime reduces deep (slow-wave) sleep by 10–20%, even when subjective sleep quality feels fine. You wake up groggier the next morning without connecting the dots.
2. You've adapted to feeling tired. Heavy caffeine users routinely sleep worse than non-users by every measurable metric, but report similar subjective sleep quality because their baseline is shifted. The lift you feel from morning coffee is mostly the withdrawal-deficit from yesterday's caffeine still tampering with last night's sleep.
The "stop by" rule
Here's the rule of thumb cleanest to follow:
> Stop drinking caffeine at least 8 hours before bedtime.
Why 8 hours and not 5? Because at 8 hours (roughly 1.6 half-lives), you have ~30% of the caffeine left in your bloodstream. That's the level at which most people's deep-sleep architecture stops being meaningfully disrupted.
If you're a known slow metabolizer (you notice a small coffee keeping you up), bump to 10–12 hours. If you're a fast metabolizer (a double espresso at 10 PM doesn't faze you), you might get away with 6.
How much caffeine is "too much" before bed?
A common threshold from sleep research: less than 20 mg of caffeine in your bloodstream at bedtime has minimal effect on sleep quality. That gives you a few hours' grace beyond your last sip.
Translating this back to "when to stop": if your typical drink is ~150 mg of caffeine (one cup of brewed coffee), you want to reach 20 mg by bedtime — that's about 3 half-lives later, or 15 hours if you take half-life as exactly 5. Conservatively, before noon for a 10 PM bedtime.
That's a lot stricter than most people apply. The middle-ground compromise: stop after 2 PM if you sleep at 10 PM, accept slight deep-sleep impact, take the productivity boost.
What about cold brew, matcha, milk tea, and energy drinks?
The half-life is the same regardless of source. What differs is the initial dose:
| Drink | Typical caffeine (mg) | Hours to drop below 20 mg | |---|---|---| | Espresso shot | 80 | ~10 | | 12 oz brewed coffee | 150–200 | ~14 | | 16 oz cold brew | 200–300 | ~16 | | Boba milk tea (large) | 100–150 | ~13 | | Matcha latte | 60–80 | ~10 | | Red Bull (250 ml) | 80 | ~10 | | Monster (500 ml) | 160 | ~14 | | KFC iced coffee | 100–150 | ~13 | | Mountain Dew (16 oz) | 70 | ~9 | | 喜茶 / 奈雪 一杯 | 50–250 (wildly varying) | up to 16 |
Note: brewing strength, cup size, and brand all swing these significantly. A "small coffee" at one chain can have more caffeine than a "large" at another.
How to actually track this
If you want to stop guessing, three options ranked by friction:
1. Manual logging in a notes app. Works if you drink ≤2 caffeinated things a day and don't mind doing math.
2. A caffeine tracker with auto-metabolism calculations. SipNote (my app) shows your real-time caffeine level on iPhone + Apple Watch with a "clear by HH:mm" estimate for when you'll drop below the sleep-safe threshold. Snap-to-log via on-device OCR means you don't have to type each drink.
3. An Apple Watch with sleep tracking + intuition. If you're disciplined about reviewing your sleep data weekly and noticing what days had the worst deep sleep, you can build the intuition over a few months. Slower than a dedicated tool but free.
A note about pregnancy, medications, and individual variation
Half-life varies wildly across people:
- Pregnancy: half-life roughly doubles to ~10–11 hours in the third trimester. Late-pregnancy caffeine has much more sleep impact than you'd expect.
- Smokers: half-life is shorter (~3 hours) because nicotine speeds liver metabolism.
- SSRIs (like Zoloft, Lexapro), oral contraceptives: half-life extends, often by 50–100%.
- Genetic variation: the CYP1A2 gene determines a lot. Slow metabolizers (about 50% of the population) have meaningfully longer half-lives and stronger caffeine-sleep effects.
If sleep is bad and caffeine timing seems borderline, try a 2-week experiment: stop all caffeine by 10 AM and see if subjective + tracked sleep improves. If yes, you're probably a slow metabolizer.
Closing
The simplest move that protects most people's sleep most of the time is to stop caffeine at lunch. The next simplest is to track and adjust. The next is to keep going as you are and accept that your subjective "I sleep fine" is probably hiding worse-than-optimal sleep architecture.
SipNote was built to make the tracking option as low-friction as possible — snap a photo, see your "clear by" forecast on your watch before bed. If you want to give it a try, App Store. $2.99 one-time, no subscription.
Frequently asked questions
How long does caffeine stay in your system?
In healthy adults, caffeine's half-life is roughly 5 hours, meaning after 5 hours half the dose is still in your bloodstream. It typically takes 15-25 hours for caffeine to fully clear, but the relevant threshold for sleep is much lower — most people are sleep-safe once their level drops below 20 mg, which usually takes 10-16 hours after a typical drink.
What time should I stop drinking coffee to sleep well?
A solid default is to stop at least 8 hours before bedtime — so if you sleep at 10 PM, stop by 2 PM. Slow metabolizers and people sensitive to caffeine should push that earlier (10-12 hours). If you only drink small amounts (under 80 mg per drink), 6 hours of buffer is usually enough.
Does decaf actually have caffeine?
Yes, a small amount — typically 2-15 mg per 8 oz cup compared to 95-200 mg in regular brewed coffee. For most people, decaf is sleep-safe at any time, but if you're extremely sensitive or a slow metabolizer, even decaf in the evening can have a small effect.
Why does caffeine affect me more than my friend?
Mostly the CYP1A2 gene, which determines how fast your liver metabolizes caffeine. About half the population are "slow metabolizers" with caffeine half-lives of 6-8+ hours; the other half are "fast metabolizers" at 3-5 hours. Pregnancy, smoking, SSRIs, and oral contraceptives all extend half-life further.
Will tracking caffeine actually improve my sleep?
Probably, but in proportion to how disciplined you are about adjusting based on what you see. Tracking by itself does nothing. The behavior change — knowing "I have 60 mg circulating at 9 PM, that's why I'm tossing tonight" — is what improves sleep. Two weeks of tracking usually surfaces the pattern; after that, the habit change is what sticks.