How the caffeine half-life calculator works
Caffeine leaves your body following first-order exponential decay — your liver clears a roughly constant fraction of it per unit time, not a fixed amount. The key number is the half-life: the time it takes for half the caffeine to clear. For a typical adult that's about 5 hours, though it ranges from roughly 4 to 6 hours and can be much longer in pregnancy, with certain medications (like some birth control), or with liver conditions.
The math is simple and exact:
remaining = dose × 0.5 (hours elapsed ÷ half-life)
So with a 5-hour half-life, a 200 mg coffee leaves about 100 mg after 5 hours, 50 mg after 10 hours, and 25 mg after 15 hours. This calculator runs that formula minute by minute, draws the curve, and finds when you cross a sleep-safe threshold — we use the lower of 50 mg or 25% of your dose, since even moderate caffeine close to bedtime can fragment sleep.
Why caffeine wrecks sleep even when you fall asleep fine
Caffeine works by blocking adenosine, the molecule that builds up while you're awake and creates sleep pressure. Even if you nod off, lingering caffeine reduces deep slow-wave sleep and can cut total sleep time — research has shown a dose as late as six hours before bed measurably disrupts sleep. You may not notice it as trouble falling asleep, just as feeling less rested the next day.
Practical takeaways
- As a rule of thumb, have your last caffeine 8–10 hours before bed — that's roughly two half-lives, enough to clear most of it.
- Bigger doses take longer to fall below the threshold, not because the half-life changes, but because you start from higher up the curve.
- If you metabolize caffeine slowly (you feel coffee for ages), set a longer half-life above for a more honest picture.
A note on safety
This calculator estimates using a single half-life and assumes the full dose is absorbed promptly. Real absorption peaks around 30–60 minutes and individual metabolism varies widely. It's general guidance, not medical advice. The FDA cites up to ~400 mg/day as generally safe for most healthy adults, but that's not universal — talk to a clinician about your own limits, especially if pregnant, on medication, or managing a heart condition.
Frequently asked questions
- How long does caffeine stay in your system?
- With a ~5-hour half-life, half remains after 5 hours, a quarter after 10, an eighth after 15. It takes roughly a full day to clear almost completely. Enter your dose above for an exact curve.
- What is the half-life of caffeine?
- About 5 hours on average for healthy adults, ranging from roughly 4 to 6. It's longer in pregnancy, with some medications, and with liver impairment; shorter in smokers.
- How many hours before bed should I stop caffeine?
- A common guideline is 8–10 hours. Even caffeine 6 hours before bed has been shown to reduce sleep quality, so earlier is safer if you're sensitive.
- Why does the calculator use a 50 mg threshold?
- It uses the lower of 50 mg or 25% of your dose as a "sleep-safe" point. Below roughly that level, caffeine's effect on most people's sleep is small — but sensitivity varies.
- Is SleepShift free?
- Completely. No account, no app to install — it runs entirely in your browser.