Caffeine Calculator
Calculate how long caffeine stays in your body. See the remaining amount after each half-life and when it is safe to sleep. Includes a sources table (coffee, tea, energy drinks, chocolate). Everything in your browser.
Not sure?
5h is the average in healthy adults. Pregnancy: 10–15h. Smokers: 3–4h.
After 1 half-life
0 mg
in 0h
After 2 half-lives
0 mg
in 0h
Safe to sleep
0h
after intake (caffeine < 50 mg)
Almost fully cleared
0h
~3% left (5 half-lives)
How it works
Caffeine follows first-order elimination kinetics, meaning the amount in your blood halves with every half-life that passes. In healthy adults that half-life averages around 5 hours, though the spread is wide. Pregnancy stretches it to 10–15h, smokers land at 3–4h, and certain variants of the CYP1A2 gene also fall outside the average.
People who want a good night of sleep generally keep caffeine under 50 mg by bedtime. The formula behind that is remaining = initial × 0.5^(t / half-life). The whole calculation runs in your browser.
Caffeine half-life and safe dose
Caffeine follows first-order pharmacokinetics, which means the blood concentration drops by half at each half-life. For healthy adults the population average sits around 5 hours (somewhere between 3 and 7 h), but pregnancy stretches that out two or three times over (10–15 h), and smokers clear it faster (3–4 h). The decay equation is remaining = initial · 0.5^(t / half-life). Take an example: drink 200 mg at 18:00 and you're left with roughly 100 mg at 23:00, 50 mg at 04:00, and only about ~6 mg by 13:00 the next day. The safe ceiling for healthy adults is 400 mg/day (FDA, EFSA). Pregnant people should keep it under 200 mg/day given the risk of miscarriage and low birth weight, and for children the figure is around 2.5 mg/kg. Where it shows up: espresso runs ~63 mg per 30 mL, drip coffee ~95 mg per 240 mL, energy drinks 80–300 mg, cola sodas 30–40 mg, and dark chocolate 20–60 mg per 100 g.
Genetics, tolerance and sleep
In the brain, caffeine blocks adenosine receptors, and that holds back the signal that builds sleep pressure. About 95% of caffeine metabolism runs through the liver enzyme CYP1A2, and a single-nucleotide polymorphism sorts people into two camps. Fast metabolizers (AA homozygotes) see less of a hit to their sleep from coffee, while slow metabolizers (AC/CC) carry higher cardiovascular risk when they drink a lot. Use caffeine every day and the brain up-regulates those adenosine receptors, so you build tolerance to the alertness boost, though not entirely to the sleep disruption. A couple of practical pointers: for an ergogenic effect, take 3–6 mg/kg about 30–45 minutes before training, and stop all caffeine at least 6 hours before bedtime. Research found that even 400 mg taken 6 h before bed cuts total sleep by roughly an hour.
FAQ
Why do I sleep fine after coffee? You might be a fast CYP1A2 metabolizer, or you've built up tolerance in your adenosine receptors. Even so, objective measures like deep sleep and HRV often still look worse, even when the sleep feels normal to you.
Does decaf have caffeine? It does. A cup usually carries 2–15 mg. That's small, but it isn't zero.
How long do withdrawal symptoms last? The headache, fatigue and irritability tend to peak 24–48 h after you stop and clear up within 7–9 days. Tapering off slowly keeps them from showing up at all.
Is caffeine dangerous? Acute toxicity is rare and generally takes more than 10 g, roughly 100 cups of coffee. With moderate intake the downsides are mostly anxiety, palpitations, GERD and disrupted sleep, and all of those are reversible.
How long caffeine stays in your body
That late-afternoon coffee might be exactly why you keep tossing and turning. Caffeine has a half-life of a few hours, so half the dose is still circulating long after your last sip. This calculator draws out that curve and helps you plan your intake with a bit more sense.
Type in the dose in mg, the half-life that applies to you and the limit you consider safe at bedtime. The tool counts in hours from now rather than clock time: it shows what is left after one and after two half-lives, and how many hours until the dose drops below your limit. There's also a table of caffeine in everyday sources, like coffee, tea, energy drinks and chocolate, so you can ballpark how much you've already had.
Whatever you enter stays put, since the math runs right in your browser and nothing is stored. Handy for people who are sensitive to caffeine but still want the lift without wrecking their sleep.
Frequently asked questions
Where do I enter the time I drank the coffee?
I clicked two items in the sources table and the values did not add up.
Why does changing the half-life shift the result so much?
Related Tools
Caffeine Decay
Estimate remaining caffeine after t hours assuming 5h half-life.
Substance Half-Life Calculator
Compute how long for a substance to leave the body (5 half-lives = undetectable). Caffeine, alcohol, nicotine, common drugs.
Caffeine Half-Life Calculator
Find out how much caffeine is still in your body after a few hours, using the roughly 5-hour half-life. Enter the dose and the time elapsed.
Radioactive Half-life
Compute remaining amount A = A₀·(1/2)^(t/T) for radioactive decay.
Number of Half-Lives
Compute how many half-lives have elapsed, n = t/T½, and the fraction of radioactive material remaining, (1/2)ⁿ, from the elapsed time and the half-life. With each half-life the amount halves: after 1 half-life 50% remains, after 2 it is 25%, after 10 less than 0.1%. It is the intuitive way to assess how much of a source (or contamination) is left. Enter the elapsed time and the half-life.
Decay Constant
Compute the radioactive decay constant, λ = ln(2)/T½, from the half-life (T½). The constant λ is the probability of a nucleus decaying per unit time — the larger it is, the more unstable the isotope and the shorter its half-life. It links the half-life (time for half the nuclei to decay) to the activity and to the exponential decay law. Enter the isotope's half-life.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.