Caffeine Calculator

That afternoon coffee is still in you at bedtime — see exactly how much is left, hour by hour, and the latest time you can drink caffeine without it following you to sleep.

A caffeine calculator estimates how much caffeine is still in your body at bedtime from the dose, the time you drank it and caffeine’s half-life, and the latest intake time that leaves no more than 50 mg at bedtime.

Result

—

Results are estimates for education and planning only — not medical advice. For questions about your own health, talk to a qualified professional.

Embed this calculator

Paste this code into your blog or website to embed this calculator. The calculator runs on BeadCalc, and your visitors use it right on your page.

About this calculator

Caffeine clears from the body by half-life: every half-life, the amount left halves. With the average half-life of about 5 hours, a 200 mg coffee at 9:00 in the morning is still about 29 mg at 23:00 — more than a quarter of a cup's worth, fourteen hours later. That residue is enough to lighten sleep and delay deep sleep even when you feel tired enough to fall asleep.

This calculator runs the decay hour by hour from the time you drank it to your bedtime, using a half-life you can adjust from 4 to 6 hours. It also works out the latest intake time that leaves no more than 50 mg in your body at bedtime — a common rule-of-thumb cutoff for sleep. The numbers are estimates: real half-lives vary between people, and pregnancy, liver conditions and some medicines slow clearance further.

How to use it

  1. Enter the caffeine in milligrams — a cup of brewed coffee is about 95 mg, an espresso shot about 63 mg, a typical energy drink about 80 mg.
  2. Enter the time you drank it and your bedtime, and pick a half-life (5 hours is the average; pick 4 if caffeine rarely keeps you up, 6 if it does).
  3. Read how much is left at bedtime and the latest intake time for no more than 50 mg left.

The formula

Remaining = dose × 0.5^(hours since intake ÷ half-life); Latest intake = bedtime − half-life × log₂(dose ÷ 50 mg)

Caffeine follows first-order (exponential) decay: after one half-life half the dose remains, after two a quarter, after three an eighth. The latest-intake time solves the same equation backwards for a 50 mg residue at bedtime — with a 200 mg dose and a 5-hour half-life that is 10 hours before bed, because 200 mg halves twice (to 50 mg) in two half-lives.

Worked example

A 200 mg coffee at 09:00 with a 5-hour half-life: by 23:00, 14 hours later, about 200 × 0.5^(14÷5) ≈ 29 mg is still in your body — roughly 14% of the dose. The latest intake that leaves no more than 50 mg at 23:00 is 13:00, ten hours before bed. The same coffee at 16:00 would leave about 76 mg at bedtime — more than half a cup's worth.

Sources: First-order (exponential) decay with a 4–6 hour half-life (5-hour average); reference doses: brewed coffee ≈ 95 mg per cup, espresso ≈ 63 mg per shot. Estimates only, not medical advice. Last updated: October 2026.

Frequently asked questions

How much caffeine is in a coffee?

Rough guides: a cup (240 ml) of brewed coffee about 95 mg, a single espresso shot about 63 mg, black tea about 47 mg, green tea about 28 mg, a cola about 34 mg, a typical energy drink about 80 mg, and dark chocolate about 20 mg per ounce. Brands vary by a factor of two, so treat these as planning figures — the calculator takes whatever milligrams you enter.

Why 4–6 hours for the half-life?

In healthy adults caffeine's half-life averages about 5 hours, with most people between 4 and 6. It runs longer in pregnancy (up to 15 hours in the third trimester), with liver disease, and with medicines such as fluvoxamine and some oral contraceptives; smokers clear it faster. If caffeine reliably keeps you up, use 6 hours — the conservative end.

Is 50 mg at bedtime really a problem?

Studies find even 100 mg at bedtime measurably lightens sleep, and 50 mg is a cautious planning cutoff rather than a proven safe line — some people are sensitive below it. The point of the calculator is the shape of the curve: caffeine taken after lunch is still substantially present at bedtime, so moving the last cup earlier is the highest-leverage change.

Is this medical advice?

No. This calculator is an educational estimate based on standard half-life arithmetic; it does not diagnose, treat or predict how caffeine affects you personally. If you have a sleep disorder, are pregnant, take medicines that interact with caffeine, or regularly use very high doses, talk to a doctor or pharmacist.

What formula does this caffeine calculator use?

Remaining = dose × 0.5^(hours since intake ÷ half-life); Latest intake = bedtime − half-life × log₂(dose ÷ 50 mg) Caffeine follows first-order (exponential) decay: after one half-life half the dose remains, after two a quarter, after three an eighth. The latest-intake time solves the same equation backwards for a 50 mg residue at bedtime — with a 200 mg dose and a 5-hour half-life that is 10 hours before bed, because 200 mg halves twice (to 50 mg) in two half-lives. The worked example on this page applies the formula step by step with real numbers, so you can verify the result by hand.