Caffeine Timing & Half-Life Calculator
See how much caffeine is still circulating at bedtime, how long a dose takes to fall to a sleep-safe level, and the latest you can have that coffee without paying for it at night.
At bedtime
To be below the threshold by bedtime, have this drink at least 4.6hours before you sleep. Half-life varies a lot between people — treat this as a guide, not a rule.
How the estimate is built
Caffeine follows exponential decay. The amount remaining after a given time is the dose multiplied by one-half raised to the power of the elapsed hours divided by your half-life. To find the latest safe time, the calculator runs that backwards: it solves for the number of half-lives it takes to fall from the dose to your sleep-safe threshold, using a base-two logarithm, and multiplies by your half-life.
The presets are rough averages — a real espresso or energy drink can vary widely by brand and size — so treat the milligram figures as a starting point and adjust to the actual product.
Frequently Asked Questions
How does caffeine leave the body?
By first-order decay, which means a fixed fraction clears in each equal stretch of time. After one half-life, half the dose remains; after two, a quarter; after three, an eighth. The amount left after t hours is the dose times one-half raised to the power of t divided by your half-life. That is the exact formula this calculator uses.
What is a caffeine half-life?
It is the time your body takes to clear half of a caffeine dose. For a typical healthy adult it is around five hours, but it varies a lot: it is shorter in regular smokers and longer in pregnancy, with certain medications (including some oral contraceptives), and with reduced liver function. If you know you are especially sensitive, set a longer half-life.
Why does an afternoon coffee affect sleep?
Because a five-hour half-life is long. A 200 mg cold brew at 3pm still leaves about 100 mg in your system at 8pm and 50 mg at 1am. Even when you fall asleep, lingering caffeine can reduce deep sleep and make the night less restorative. The calculator shows exactly how much is left at your bedtime so you can judge the trade-off.
What is the sleep-safe threshold?
It is the level below which caffeine is unlikely to disturb your sleep — set to 50 mg by default, roughly half a cup of coffee. It is a rule of thumb, not a hard line: sensitivity differs, so a cautious sleeper might set it lower. The tool works out how many hours it takes your dose to decay to that level, which is the latest you should have it before bed.
Educational estimate only — not medical or dietary advice. Caffeine metabolism varies widely, and caffeine affects health conditions, pregnancy, and medications differently. Follow product labels and consult a doctor or pharmacist about your own intake.