Home › Health › Caffeine Half-Life Calculator
Caffeine Half-Life Calculator
Computes the caffeine remaining after a given time by first-order elimination with an adjustable half-life (about 5 hours in healthy adults), the time until the amount falls below a threshold, and a 24-hour decay schedule.
When to use
You want to know how much of a coffee, tea or energy-drink dose is still active after some hours, or when it will drop below a chosen level before bedtime.
Do not use when: You need guidance for pregnancy, liver disease, children or drug interactions, where the half-life can be two to three times longer; the result is informational only, not medical advice. For generic exponential decay use half-life.
Formula
remaining_mg = dose_mg × 0.5^(hours_elapsed / half_life_hours); percent_remaining = 100 × 0.5^(hours_elapsed / half_life_hours); hours_until_threshold = half_life_hours × log2(dose_mg / threshold_mg), 0 when dose_mg ≤ threshold_mg; hours_until_threshold_from_now = max(0, hours_until_threshold − hours_elapsed)
Assumes first-order (exponential) elimination and complete absorption at time zero; absorption actually takes 30–60 minutes and the half-life ranges from about 1.5 to 9.5 h between adults. Informational only, not medical advice.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
dose_mg | number | mg | yes | Caffeine taken at time zero. Typical: brewed coffee ≈ 95 mg per 240 mL cup, espresso ≈ 63 mg per 30 mL shot, black tea ≈ 47 mg per cup, cola ≈ 34 mg per 355 mL, energy drink ≈ 80 mg per 250 mL. Range: > 0, ≤ 2000 |
hours_elapsed | number | h | yes | Time since the dose was taken. Range: ≥ 0, ≤ 72 |
half_life_hours | number | h | default 5 | Elimination half-life: about 5 h in healthy adults (FDA), shorter in smokers (≈ 3 h), longer with oral contraceptives, in pregnancy or with liver disease. Range: ≥ 1.5, ≤ 10 |
threshold_mg | number | mg | default 25 | Amount below which the remaining caffeine is considered negligible (25 mg ≈ a quarter cup of coffee). Range: > 0, ≤ 2000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
remaining_mg | number | mg | Caffeine still in the body after hours_elapsed. |
percent_remaining | number | % | remaining_mg as a percentage of the dose. |
half_lives_elapsed | number | hours_elapsed / half_life_hours. | |
hours_until_threshold | number | h | Time from the dose until the amount falls to threshold_mg (0 when the dose is already at or below it). |
hours_until_threshold_from_now | number | h | hours_until_threshold minus hours_elapsed, floored at 0. |
schedule | list | Objects with hours and remaining_mg at 0, 2, 4, 6, 8, 10, 12, 16, 20 and 24 hours after the dose. |
Example
200 mg after 10 h, half-life 5 h: {"dose_mg":200,"hours_elapsed":10,"half_life_hours":5,"threshold_mg":25} → {"remaining_mg":50,"percent_remaining":25,"half_lives_elapsed":2,"hours_until_threshold":15,"hours_until_threshold_from_now":5}
One 95 mg coffee after 6 h: {"dose_mg":95,"hours_elapsed":6} → {"remaining_mg":41.35,"percent_remaining":43.53,"hours_until_threshold":9.63,"hours_until_threshold_from_now":3.63}
GET https://tttkmbb.com/api/v1/calculate/caffeine-half-life?dose_mg=200&hours_elapsed=10&half_life_hours=5&threshold_mg=25
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/caffeine-half-life(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/caffeine-half-life · Markdown: https://tttkmbb.com/health/caffeine-half-life.md · JSON definition: https://tttkmbb.com/health/caffeine-half-life.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="caffeine-half-life" - OpenAPI operationId:
calculate_caffeine_remaining - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- FDA – Spilling the Beans: How Much Caffeine is Too Much? (government)
- Wikipedia – Caffeine (pharmacokinetics) (reference)
FAQ
How much caffeine is in my drink?
Roughly: brewed coffee 95 mg per 240 mL cup, espresso 63 mg per shot, black tea 47 mg, green tea 28 mg, cola 34 mg per 355 mL can, energy drink 80 mg per 250 mL. Check the label when it states a value.
When should I stop drinking coffee before bed?
With a 5 h half-life, half of a dose is still present after 5 h and a quarter after 10 h; many sleep guidelines suggest no caffeine within 6–8 hours of bedtime. Use the threshold outputs to find the time for your own dose.
Related calculators
- Half-Life Calculator — Generic exponential decay for any substance or half-life.
- Sleep Cycle Calculator — Plan a bedtime once the caffeine has worn off.