What this calculator estimates
Add the drinks you've had today and when you had them, set tonight's bedtime, and the tool tells you roughly how many milligrams of caffeine are still in your bloodstream when you lie down. It does this by modeling exponential decay on each dose separately from the moment you drank it, then summing what's left.1
That's the number that matters for sleep. Not how much caffeine you consumed, and not whether you still feel it — but how much is chemically present at lights-out, quietly working against the deep sleep you're counting on.
The half-life, and why the afternoon coffee lingers
Caffeine's half-life in a typical adult is about 5 hours — the time to clear half a dose.1 The calculator's "typical" setting uses this. The catch with a five-hour half-life is how slowly the tail decays. Take a 140 mg drip coffee at 8 AM:
| Time | Caffeine remaining (≈5 h half-life) |
|---|---|
| 8:00 AM (drink) | 140 mg |
| 1:00 PM | 70 mg |
| 6:00 PM | 35 mg |
| 11:00 PM | ~17 mg |
That's from a morning coffee. Now picture the 2 PM pick-me-up so many of us reach for: at an 11 PM bedtime, well over half of it is still on board. You won't feel jittery — the subjective buzz fades long before the molecule does — but a controlled study found caffeine taken even 6 hours before bed measurably cut total sleep.2 The feeling of being "over it" is not the same as being clear of it.
This is why the tool's advice at higher levels is so specific: the highest-leverage move is usually the same total caffeine, but nothing after early afternoon.
Individual variation: CYP1A2 and the metabolizer setting
Here's why blanket rules fail. Most caffeine is broken down by a single liver enzyme, CYP1A2, and a common variation in the gene that codes for it splits people into fast and slow metabolizers.3 The spread is large:
- Fast metabolizer (~3 h half-life): clears caffeine quickly; an afternoon coffee is often genuinely fine.
- Typical (~5 h): the standard assumption.
- Slow metabolizer (~8 h): caffeine hangs on; a lunchtime coffee can still be a third present at midnight.
The calculator lets you pick, because the same espresso is a nonevent for one person and a wrecked night for another.4 If you've never been sure which camp you're in, the tell is simple: people who "can drink coffee at dinner and sleep fine" are usually fast metabolizers; people wired by a 3 PM cup are usually slow. Set it honestly and the bedtime number will fit your actual experience.
Several things push clearance toward the slow end regardless of genes, and the tool notes them: pregnancy (which can more than double the half-life), oral contraceptives, and some medications all slow it down; smoking speeds it up. If any of those apply, lean slow and treat the estimate as a minimum.
The loop with sleep debt
Caffeine and sleep debt feed each other, and it's worth being clear-eyed about it. When you're short on sleep, caffeine blocks the adenosine that signals tiredness — so you feel capable while your reaction time and judgment are still impaired. It masks the debt; it never pays it.
Then the residue you can now see in this calculator lightens and fragments the night's sleep, which grows the debt, which sends you back to the pot tomorrow a little earlier and a little stronger. Round it goes.
If you recognize that pattern, the caffeine number here is only half the picture. Run your last seven nights through the sleep debt calculator to see what you're actually masking — the fix is often to pay down the debt so you need less caffeine, not to time the caffeine more cleverly. And once the last dose is early enough, the sleep cycle calculator helps you spend the recovered night well.
How to use the number
- If bedtime shows "clear" (under ~20 mg): caffeine is unlikely to be tonight's problem. Look elsewhere — the scroll before bed, the racing mind, the room temperature.
- If it shows light to moderate (~20–100 mg): you'll probably fall asleep, but the sleep may run lighter and more broken than it should. Nudge your last dose 2–3 hours earlier and re-check.
- If it shows high (100 mg+): that's a full cup or more still circulating at lights-out — enough to delay sleep onset and cut deep sleep. Move the afternoon dose to the morning and watch the number collapse.
One honest limit: this is a population model, not a blood test. It can't see your exact enzyme activity, today's food, or the precise caffeine in a café's pour. Use it to spot patterns and compare timings — "my 3 PM coffee leaves 90 mg at bedtime, my noon one leaves 45" — rather than as a clinical readout. For that purpose, comparing your own scenarios, it's genuinely useful.
Caffeine is one of the few sleep levers you fully control, and it's the one most people are quietly getting wrong by an hour or two. This tool exists to find that hour.