Whether you are timing a pre-workout dose before training, wondering why you cannot fall asleep at midnight, or trying to schedule your last coffee of the day, this caffeine half-life calculator gives you a precise, evidence-based picture of exactly how much caffeine remains in your body at any point in time.
How the caffeine decay formula works
Caffeine follows first-order pharmacokinetics — meaning a fixed fraction of whatever is in your bloodstream is eliminated per unit of time. That produces exponential decay, described by:
C(t) = C₀ × 2^(−t ÷ half-life)
where C₀ is the initial dose in milligrams, t is the time elapsed since consumption in hours, and half-life is your personal clearance rate (default 5 h). The calculator applies this formula to every dose you enter, then sums the contributions to get your total current load.
To find when you hit a target (your sleep threshold), the formula is inverted:
t = half-life × log₂(C₀ ÷ threshold)
All arithmetic runs locally in your browser — nothing is sent to a server.
Why the half-life matters so much
With a 5-hour half-life a single 200 mg dose (two shots of espresso) decays like this:
| Time after drinking | Caffeine remaining |
|---|---|
| 0 h (just consumed) | 200 mg |
| 5 h | 100 mg |
| 10 h | 50 mg |
| 15 h | 25 mg |
| 20 h | 12.5 mg |
If you consumed those same two shots at 8 AM, you would still have roughly 50 mg circulating at 6 PM — enough to noticeably reduce sleep quality. Add a 3 PM coffee and you could easily cross 100 mg at midnight.
Worked example
Scenario: You have a double espresso (126 mg) at 8:00 AM and a filter coffee (95 mg) at 1:00 PM. Your half-life is 5 hours and you want to be below 25 mg before sleeping.
-
At 6:00 PM (10 h after dose 1, 5 h after dose 2):
- Espresso remaining: 126 × 2^(−10/5) = 126 × 0.25 = 31.5 mg
- Filter coffee remaining: 95 × 2^(−5/5) = 95 × 0.5 = 47.5 mg
- Total at 6 PM: 79 mg
-
Time from 6 PM until total drops to 25 mg:
- 5 × log₂(79/25) = 5 × 1.66 = 8.3 hours
- Safe to sleep from approximately 02:18 AM
Enter those numbers into the calculator above and the decay chart will confirm this with a visual curve.
Using your personal half-life
The population median is 5 hours but the range in healthy adults spans 1.5–9.5 hours. People who smoke metabolise caffeine roughly twice as fast (half-life ~3 h). Those taking hormonal contraceptives or who are pregnant may process it at half the speed (half-life ~9 h). If you know from experience that coffee keeps you wired for much longer or shorter than friends, shift the slider — the sleep-safe time will update immediately.