How much caffeine is still in you?
Add today’s drinks and when you had them: see the caffeine left at bedtime and when it falls below a level you pick.
Half-life is how long the body takes to clear half a dose. EFSA gives about 4 hours for healthy adults, within a range of 2 to 8. It is longer in pregnancy and with some medicines.
100 mg is the single dose EFSA says may affect sleep in some adults near bedtime. Choose your own level if you like.
What the number tells you
Caffeine is cleared from the body at a steady proportion, not a steady amount: every few hours about half of whatever is left disappears. That is why a coffee at 2 PM can still be in you at bedtime. The calculator adds up all your drinks, each decaying from the time you drank it, and reports how many milligrams are left when you go to bed, when the level crosses a threshold of your choice, and the total for the day compared with the 400 mg guidance (or 200 mg for pregnancy and breastfeeding).
The method
For a drink of D milligrams taken at time t₀, the amount left at time t is D × 2^(−(t − t₀) ÷ h), where h is the half-life in the same time unit. The total is the sum over all the drinks you took before t. After the last drink the total only falls, so the time to reach a threshold L is t_last + h × log₂(A ÷ L), where A is the total just after that last drink. The drink amounts are the midpoints of the FDA ranges for a 12-ounce serving (decaf: 8 ounces); a drink of a different size is entered as more or fewer servings, for example 0.67 for an 8-ounce cup of coffee.
A worked example
Two 12-ounce coffees, one at 8:00 AM and one at 2:00 PM, each taken as 180 mg (the middle of the FDA’s 113 to 247 mg), and bedtime at 10:00 PM. With a 5-hour half-life the morning coffee has fallen to 78 mg by 2 PM, so right after the second cup the body holds 258 mg. At bedtime, 8 hours later, 85 mg are left, and the level reaches 50 mg at 1:51 AM the next day. The total for the day is 360 mg, under the 400 mg guidance. Change only the half-life and the picture moves a lot: with 4 hours, 61 mg are left at bedtime; with 8 hours, 144 mg. That spread, not any single answer, is the honest result.
Limits of this method
The half-life is a person’s own. EFSA gives about four hours on average and two to eight hours for healthy adults, and lists age, body weight, pregnancy status, medicines and liver health among the causes of the difference. It lengthens in pregnancy, so the 200 mg guidance for pregnant and breastfeeding women is not something to stretch with a clever schedule. This page is no replacement for asking your doctor.
Drinks are not labeled alike. The FDA’s own table gives 113 to 247 mg for 12 ounces of brewed coffee and 41 to 246 mg for an energy drink, so the middle of a range can be wrong by a factor of two. Use the number on the label when there is one. Caffeine in chocolate, medicines and supplements is not in the list: add it as “Other”.
Sleep is not just a level. The calculator does not say what level will keep you awake. EFSA found that a 100 mg dose near bedtime may affect sleep in some adults, and the 2013 trial gave 400 mg at 6, 3 and 0 hours before bed and found disturbed sleep in all three cases, in 12 people. Many people feel nothing at that level, and the trial participants did not always notice the change. Treat the threshold as your experiment.
Common questions
How long does caffeine stay in your body?
The half-life, the time for the body to get rid of half of a dose, is about four hours in a healthy adult, with a range of two to eight hours, according to the European Food Safety Authority. After two half-lives a quarter is left, after three an eighth. With a 5-hour half-life, a 100 mg dose is 50 mg after 5 hours, 25 mg after 10 and about 12 mg after 15.
How much caffeine is too much in a day?
The FDA cites 400 milligrams a day, about two to three 12-ounce cups of coffee, as an amount not generally associated with negative effects in healthy adults, and notes that people differ a lot in sensitivity. EFSA reaches the same 400 mg for healthy adults (about 5.7 mg per kilogram of body weight) and 200 mg a day for pregnant and lactating women, and says single doses of up to 200 mg do not raise safety concerns for healthy adults.
When should I stop drinking coffee to sleep well?
There is no single hour. EFSA says that single doses of 100 mg may affect sleep duration and patterns in some adults, especially close to bedtime. In a 2013 trial in the Journal of Clinical Sleep Medicine, 400 mg of caffeine taken as a pill 6, 3 or 0 hours before bedtime disturbed measured sleep in 12 healthy adults, even at 6 hours. The calculator shows the level at your bedtime and the time it drops to a level you pick, so that you can see what your own cutoff looks like.
Does the half-life change from person to person?
Yes. EFSA names age, body weight, pregnancy status, medicines and liver health among the reasons, and the half-life gets longer in pregnancy. The calculator therefore lets you type your own number, from 1 to 24 hours. If you feel caffeine for a long time, try 6 to 8 hours; if you shrug it off, 3 to 4.
How much caffeine is in my drink?
The FDA lists, per 12 fluid ounces: caffeinated soft drinks 23 to 83 mg, green tea 37 mg, black tea 71 mg, regular brewed coffee 113 to 247 mg and energy drinks 41 to 246 mg, and 2 to 15 mg in an 8-ounce cup of decaf. The calculator uses the middle of each range, for example 180 mg for a 12-ounce coffee. Your cup can be well above or below that: the brand, the roast and the brewing change it, so choose “Other” and type the number from the label if you have one.
Is the level in my body the same as the level in my blood?
No: the calculator tracks the milligrams of caffeine from your drinks that are still in the body, not a blood concentration, and it treats each dose as absorbed at once. In reality caffeine peaks within an hour or so (the effects start 15 to 30 minutes after a drink, EFSA says), so the curve here is a simple model and the first hour after a drink is only approximate.
Plan your night with the sleep calculator, see how drinking alcohol adds up in the BAC calculator, or dial in your brew with the coffee ratio calculator.
For general information only, not medical advice. Caffeine affects people differently, and this is a simple model, not a measurement of your blood. If you are pregnant, have a heart condition, anxiety or a sleep disorder, or take medicines, ask your doctor how much caffeine is right for you. Sources, read October 27, 2026: U.S. Food and Drug Administration, Spilling the Beans: How Much Caffeine Is Too Much? (caffeine per serving and the 400 mg a day figure); European Food Safety Authority, Scientific Opinion on the safety of caffeine (2015) and its consumer summary “Caffeine: EFSA explains risk assessment” (400 mg a day, 200 mg a day in pregnancy, single doses of 100 mg and sleep, half-life of about four hours with a range of two to eight hours); Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine 2013;9(11):1195–1200. How we check our calculators.