What it is for
Caffeine does not vanish at once: the body clears it gradually, and some of it is still circulating hours later. This calculator estimates how much is left when you plan to sleep and when what remains falls below a threshold you choose (25 mg by default, an arbitrary small level, roughly a quarter of a cup of coffee).
Formulas
We use exponential decay by half-life: remaining = dose × 0.5^(t ÷ half-life), where t is the number of hours between intake and bedtime (if bedtime is earlier on the clock than the intake time, we assume it is the next day). The time to fall to a threshold is t = half-life × log₂(dose ÷ threshold).
Half-life and individual variation
For adults, a caffeine half-life of about 5 hours is commonly cited, with a range of roughly 3 to 7 hours. Genetics, smoking, pregnancy, some medications and other factors change it, which is why the field is adjustable. Sensitivity to caffeine's effects also varies a lot between people.
Caffeine in common drinks (approximate averages)
| Drink | Approx. caffeine |
|---|---|
| Espresso (1 shot) | 63 mg |
| Brewed coffee, 240 mL | 95 mg |
| Black tea, 240 mL | 47 mg |
| Cola, 355 mL | 34 mg |
| Energy drink, 250 mL | 80 mg |
These are approximate averages; actual content varies widely by brand, preparation and size. Check the label when there is one.
Worked example
A 95 mg coffee at 15:00, bedtime at 23:00 (8 hours later), half-life 5 h: 95 × 0.5^(8÷5) ≈ 31.3 mg (33%) remains. Reaching 25 mg takes 5 × log₂(95÷25) ≈ 9.6 hours, that is, around 00:38 the next day.
Daily limit and limits of this tool
The US FDA cites 400 mg a day as an amount not generally associated with negative effects in healthy adults. That figure does not fit everyone: pregnant people, those with certain conditions and caffeine-sensitive people may need lower limits.
It is an estimate. There is no universal amount of caffeine considered safe before sleep, and the effect on sleep is personal. Not medical advice.
Frequently asked questions
What is caffeine half-life?
It is the time the body takes to clear half of the caffeine in circulation. With a 5 h half-life, 100 mg becomes 50 mg after 5 h and 25 mg after 10 h.
Which threshold should I pick?
There is no single value. The 25 mg default is just a low reference point; more sensitive people may prefer a lower threshold.
How much caffeine is too much per day?
For healthy adults, the FDA cites 400 mg a day as an amount generally not associated with negative effects. There are exceptions, such as pregnancy and individual sensitivity.
Does it work for tea, soda and energy drinks?
Yes: enter the dose in mg. The table in the article gives approximate averages for common drinks.