Sleeptly

Caffeine calculator

When should you stop drinking coffee?

Caffeine has a half-life of roughly 5 hours in healthy adults. That 3 PM espresso is still ≈ 30 mg in your system at 11 PM — enough to push slow-wave sleep down measurably even when you fall asleep normally. Run your dose through the decay curve.

Residual at bedtime
27 mg
Safe for sleep
Hours to safe (< 50 mg)
4.6 h
Latest safe intake
18:22

Caffeine decay curve

bedtime50 mg safe line0h16h

How the math works

Caffeine follows first-order elimination kinetics: a fixed fraction decays per unit time. The residual after t hours is dose × 0.5^(t / halfLife). The 50 mg threshold used as the "safe for sleep" line comes from controlled studies showing sleep architecture (slow-wave sleep, latency) is meaningfully affected above ≈ 100 mg residual at bedtime.

Half-life varies a lot between individuals: pregnancy nearly doubles it; oral contraceptives extend it 50%; smoking shortens it by ≈ 30%. CYP1A2 polymorphisms split the population into "fast" and "slow" metabolizers. Adjust the slider to match what you know about yourself, or default to 5h.

Sources: IOM, Caffeine for Mental Task Performance (2001)· Clark & Landolt, Sleep Med Rev 2017· Drake et al., J Clin Sleep Med 2013 (0/3/6h before bed RCT)

Related tools