Caffeine Calculator
Add today's drinks and your bedtime to see how much caffeine is still in your body, when it drops below a level you pick, and the latest time for another cup.
Caffeine amounts are typical, check the label: they vary a lot by brand, brew and cup size. Change any figure to match your drink.
About 5 hours on average; it varies a lot (roughly 2–10 h) — longer in pregnancy, with some medicines, and shorter in smokers.
50 mg is just an example level. There's no single figure that suits everyone's sleep, so pick your own.
0 ignores absorption. Above 0, each drink starts counting this many minutes after you have it (often 30–60 min).
For "latest time for another drink". 95 mg is a typical cup of coffee.
Used only to show your caffeine per kg of body weight. It doesn't change how fast caffeine clears in this simple model.
How your caffeine level is worked out
Every drink halves once per half-life; what's left of each is added up.
- 1
Add up your drinks
95 + 63 + 34 mg= 192 mg today
- 2
Halves each half-life
95 × 0.5^(15 ÷ 5)= 11.9 mg leftfirst drink, at bedtime
- 3
Left at bedtime
11.9 + 15.8 + 17.0= 44.6 mgat bedtime, 23:00
- 4
Below your level
Under 50 mgfrom 22:1149 min before bed
Read more: the formula, a worked example, typical drinks and notes
Your body clears caffeine at a steady rate in proportion to how much is there, so the amount falls by half every half-life. This calculator takes each drink, works out how many half-lives have passed by a given time, and adds up what is left of every drink. In Simple mode it ignores absorption and counts each drink in full from the moment you have it (in real life caffeine takes roughly 30–60 minutes to be absorbed). Advanced lets you add a simple delay instead.
An estimate, not medical advice. How fast caffeine clears varies a lot from person to person and day to day, and some people are much more sensitive to it than others. Caffeine is also found in chocolate, some medicines and supplements. If you have trouble sleeping, are pregnant or breastfeeding, have a heart condition or take medicines, talk to your doctor or pharmacist.
The formula
Caffeine left from one drink = caffeine in the drink × 0.5 ^ (hours since you had it ÷ half-life)
Caffeine in your body = what's left of every drink, added up
Time it drops below your level = time of the last drink that leaves you above it + half-life × log2(caffeine just after that drink ÷ your level)
Latest time for one more drink = bedtime − half-life × log2(that drink ÷ (your level − caffeine at bedtime))
With an absorption delay, each drink's clock starts that many minutes after you have it.
log2 means "how many times do you halve to get from one number to the other": log2(4) = 2, because 4 halves to 2 and then to 1.
Worked example
You have a cup of coffee (95 mg) at 08:00, an espresso (63 mg) at 13:00 and a can of cola (34 mg) at 18:00, go to bed at 23:00, and use a 5-hour half-life. By bedtime the coffee has had 15 hours, which is 3 half-lives: 95 × 0.5³ = 95 × 0.125 = 11.875 mg. The espresso has had 10 hours (2 half-lives): 63 × 0.25 = 15.75 mg. The cola has had 5 hours (1 half-life): 34 × 0.5 = 17 mg. So at bedtime about 11.875 + 15.75 + 17 = 44.625 mg (about 44.6 mg) is left.
Just after the cola at 18:00 you have 95 × 0.25 = 23.75 mg from the coffee, 63 × 0.5 = 31.5 mg from the espresso and 34 mg from the cola: 89.25 mg. Getting below 50 mg takes 5 × log2(89.25 ÷ 50) = 5 × log2(1.785) = 5 × 0.836 = 4.18 hours, about 4 h 11 min, so you drop below 50 mg at about 22:11, 49 minutes before bed. Your highest point was just after the espresso: 95 × 0.5 + 63 = 110.5 mg at 13:00. In total you had 95 + 63 + 34 = 192 mg, 48% of the often-cited 400 mg a day.
Another 95 mg coffee would leave room for only 50 − 44.625 = 5.375 mg at bedtime. That takes 5 × log2(95 ÷ 5.375) = 5 × 4.144 = 20.7 hours to fall to, so you'd have needed it by about 02:17 this morning: too late today to stay under 50 mg at bedtime.
Typical caffeine in drinks
| Drink | Typical caffeine |
|---|---|
| Coffee, 1 cup (240 ml / 8 oz) | about 95 mg |
| Espresso, 1 shot (30 ml / 1 oz) | about 63 mg |
| Black tea, 1 cup (240 ml / 8 oz) | about 47 mg |
| Cola, 1 can (355 ml / 12 oz) | about 34 mg |
| Energy drink, 1 can (250 ml / 8.4 oz) | about 80 mg |
Rough typical figures for illustration only; they have not been checked against an official food database. Real drinks vary widely: a large coffee-shop coffee can have two or three times as much, a double espresso has two shots, and decaf still has a little. Check the label or the shop's own figures.
How much in a day?
Often-cited guidance (for example by food-safety agencies) is up to about 400 mg a day for most healthy adults, with lower amounts advised in pregnancy. It is a general figure, not a personal limit: check with your doctor, especially if you are pregnant.
Why your real level may be different
- Half-life: about 5 hours on average but roughly 2–10 hours between people. It tends to be longer in pregnancy and with some medicines, and shorter in smokers.
- Absorption: caffeine reaches your blood over roughly 30–60 minutes, more slowly with food. Simple mode ignores this.
- Drink strength: brew, bean, cup size and brand change the caffeine a lot.
- Sensitivity: the same amount affects people differently, so a level that's fine for one person can keep another awake.
Common questions
What is the half-life of caffeine?
About 5 hours on average for a healthy adult, but it varies a lot, roughly 2 to 10 hours. It tends to be longer in pregnancy, with some medicines and with liver problems, and shorter in people who smoke. After one half-life about half the caffeine is left, after two about a quarter, and so on.
How long does caffeine stay in your body?
It falls by half every half-life, so with a 5-hour half-life a 95 mg cup of coffee drops to about 47.5 mg after 5 hours, 23.75 mg after 10 hours and 11.9 mg after 15 hours. Small amounts can linger for a day, which is why an afternoon coffee can still be with you at bedtime.
When should I stop drinking coffee before bed?
It depends on how much you drink, your own half-life and how sensitive you are. Many people find stopping some hours before bed helps. Put in your drinks and bedtime and this calculator shows how much is likely left when you go to bed, and the latest time another drink would keep you under a level you choose.
How much caffeine is in a cup of coffee?
A typical 240 ml (8 oz) cup of brewed coffee has around 95 mg, a single espresso around 63 mg, a cup of black tea around 47 mg, a 355 ml can of cola around 34 mg and a 250 ml energy drink around 80 mg. Real drinks vary a lot by brand, bean, brew and cup size, so check the label or the shop's figures.
How much caffeine is too much in a day?
Often-cited guidance from health and food-safety agencies is up to about 400 mg a day for most healthy adults, with lower amounts advised in pregnancy. People's sensitivity differs, so check with your doctor, especially if you are pregnant, breastfeeding, have a heart condition or take medicines.
Related calculators
Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.