Quick answer: Caffeine’s half-life in healthy adults is usually 3 to 7 hours, so half of an afternoon coffee can still be in your body at bedtime. A sleep study found 400 mg of caffeine taken even 6 hours before bed cut sleep by more than an hour. Enter today’s drinks, your bedtime and your metabolism below to see how much caffeine is left when you go to bed and the latest time another cup would still fit.
Most advice on when to stop drinking coffee is a single number of hours. That ignores how much you drank, when you drank it and how fast your body clears caffeine. This calculator uses the same model pharmacology texts use for caffeine, a simple exponential decay, and shows every number it relies on, so you can check the maths yourself.
Caffeine cutoff calculator
An assumption, not a medical rule. Lower it if you are sensitive.
Estimate only, using a one-compartment model with instant absorption. Not medical advice.
In this guide 7 sections
How the caffeine cutoff calculator works
Each drink is a dose of caffeine taken at a known time. Your body clears caffeine at a roughly constant fraction per hour, so every half-life the amount left from a dose halves. The calculator adds up what is left of every dose at any moment:
remaining(t) = Σ dose_i × 0.5 ^ ((t − t_i) / half_life)
Here dose_i is the caffeine in drink i in mg, t_i is when you drank it and half_life is in hours. The caffeine cutoff is the latest time a standard 95 mg cup of brewed coffee could be added and still leave you at or under your threshold at bedtime. Solving the formula for that time gives:
cutoff = bedtime − half_life × log2(95 / (threshold − remaining(bedtime)))
If what you have already drunk is over the threshold at bedtime, there is no cutoff left for today. The assumptions, stated plainly:
- Instant absorption. Caffeine is treated as fully in your body the moment you drink it. In reality absorption takes some time, so the peaks on the chart come slightly early.
- One compartment, first-order elimination. Clearance is a constant fraction per hour. That is a standard simplification, not a measurement of you.
- A fixed half-life for the whole day. Your half-life is set by the profile you choose.
- Typical drink values. Real cups vary with beans, brew strength and size, so use the custom amount if a label gives the caffeine.
- A sleep-friendly threshold you choose. The default of 50 mg is an assumption for this tool, not a medical rule. No official body sets a bedtime caffeine limit.
Half-life values the calculator uses
Studies report a wide range: one review puts caffeine’s half-life at anywhere from 1.5 to 9.5 hours, and a 2017 safety review gives 3–7 hours for adults. The FDA notes “wide variation” in how fast people eliminate caffeine. The profiles are:
| Profile | Half-life used | Notes |
|---|---|---|
| Typical adult | 5 h | Middle of the 3–7 h adult range; control groups averaged 5.1–5.4 h in two studies |
| Smoker (faster) | 3.5 h | Smoking roughly doubles caffeine clearance; measured half-lives were about 30–37% shorter in smokers than nonsmokers |
| Oral contraceptives (slower) | 10 h | Oral contraceptives “tend to double” the half-life; one study measured 7.9 h vs 5.4 h |
| Pregnant, later months (slower) | 10.5 h | Measured in the last 4 weeks of pregnancy; it rises from early pregnancy and can be longer |
| Custom | 1–30 h | For anyone whose doctor has given them a figure, including people with liver disease |
Caffeine in each drink
The preset amounts come from USDA FoodData Central values per 100 g, multiplied by the serving weight, and from the FDA for decaf. Drinks with no reliable single figure, such as cold brew and energy drinks, ask you to enter the number from the label. For more on why cups vary, see our guide to how much caffeine is in coffee.
| Drink | Caffeine used | Source |
|---|---|---|
| Brewed coffee, 8 oz (237 g) | 95 mg | USDA FDC 171890: 40 mg per 100 g |
| Espresso, 1 oz shot (29.6 g) | 63 mg | USDA FDC 171891: 212 mg per 100 g |
| Decaf coffee, 8 oz | 15 mg | FDA: typically 2–15 mg; the top of the range is used |
| Black tea, 8 oz (237 g) | 47 mg | USDA FDC 173227: 20 mg per 100 g |
| Green tea, 8 oz (237 g) | 28 mg | USDA FDC 171917: 12 mg per 100 g |
| Cola, 12 oz (about 368 g) | 33 mg | USDA FDC 174852: 9 mg per 100 g (FDA gives 23–83 mg for 12 oz caffeinated soft drinks) |
| Energy drink, cold brew | you enter it | FDA: energy drinks range from 54 to 328 mg per 16 oz, too wide for one preset |
A worked example
Take a typical adult (5 h half-life) who has a brewed coffee (95 mg) at 7:30 am and an espresso (63 mg) at 1 pm, and goes to bed at 10:30 pm.
- The coffee has 15 hours to clear, which is 3 half-lives: 95 × 0.5³ = 11.9 mg left.
- The espresso has 9.5 hours, which is 1.9 half-lives: 63 × 0.5^1.9 = 16.9 mg left.
- Caffeine at bedtime is 11.9 + 16.9 = 28.8 mg, under the 50 mg threshold.
- Room left under the threshold: 50 − 28.8 = 21.2 mg. Another 95 mg cup has to fall to 21.2 mg by bedtime: log2(95 / 21.2) = 2.16 half-lives, or 10.8 hours.
- 10:30 pm minus 10.8 hours gives a cutoff of about 11:42 am.
So with a 50 mg threshold, a third cup would need to be before lunch. Change the profile to oral contraceptives (10 h) and the same two drinks leave about 66 mg at bedtime, already over the threshold. The half-life matters more than any other input, which is why a fixed “stop at 2 pm” rule fits some people and not others.
What changes caffeine half-life
- Smoking speeds clearance by raising liver enzyme activity; it roughly doubles the clearance rate.
- Pregnancy slows it a lot. On average, the half-life is 8.3 hours longer during pregnancy and may be as much as 16 hours longer. ACOG says moderate intake of less than 200 mg a day does not appear to be a major factor in miscarriage or preterm birth; see coffee during pregnancy for the details.
- Oral contraceptives slow it, because steroid hormones slow caffeine metabolism.
- Liver disease reduces caffeine clearance, most of all in cirrhosis. There is no single figure, so ask your doctor and use the custom half-life.
- Medications and medical conditions also matter: the FDA lists both among the things that change how much caffeine is too much for you.
For the bigger picture of how caffeine moves through your body, read how long coffee stays in your system. If you love an evening cup, our guide to coffee after dinner has ways to keep the ritual without the caffeine, and these coffee alternatives with caffeine cover lower-dose swaps for earlier in the day.
The bar under the results compares your day’s total with the FDA’s figure of 400 mg a day for most healthy adults, an amount “not generally associated with negative effects”, or with 200 mg if you choose the pregnancy profile. Those are daily totals and say nothing about timing, which is what the cutoff is for.
Frequently asked questions
How many hours before bed should I stop drinking coffee?
Sleep research supports avoiding substantial caffeine for at least 6 hours before bed. The authors note that published advice ranges from 4 to 11 hours, because half-life varies so much. The calculator works out a time for your drinks and half-life.
How long does it take for caffeine to leave your body?
About five half-lives clears roughly 97% of a dose. With a 3–7 hour half-life, that is about 15 to 35 hours, so a regular coffee drinker rarely gets to zero.
Is 50 mg at bedtime safe for sleep?
There is no official bedtime caffeine limit. The 50 mg default is an assumption for this tool. If you sleep badly with it, lower the threshold and see how far your cutoff moves.
Sources
- FDA, Spilling the Beans: How Much Caffeine is Too Much? (400 mg/day guidance, decaf, soft drink and energy drink ranges)
- ACOG Committee Opinion No. 462, Moderate Caffeine Consumption During Pregnancy (less than 200 mg/day)
- Temple JL et al., The Safety of Ingested Caffeine: A Comprehensive Review, Front Psychiatry 2017 (3–7 h half-life; smoking, pregnancy, oral contraceptives, liver disease)
- Somani SM, Gupta P, Caffeine: a new look at an age-old drug, 1988 (half-life 1.5–9.5 h)
- Cardiovascular effects of coffee and caffeine, Am J Cardiol 1984 (3.2 h in smokers vs 5.1 h in nonsmokers)
- Population pharmacokinetics of caffeine, J Clin Pharm Ther 2009 (3.0 h in smokers vs 4.3 h in nonsmokers)
- Abernethy DR, Todd EL, Eur J Clin Pharmacol 1985 (oral contraceptives: 7.88 h vs 5.37 h)
- Knutti R et al., The effect of pregnancy on the pharmacokinetics of caffeine, 1982 (10.5 h in the last 4 weeks of pregnancy)
- Grzegorzewski J et al., Pharmacokinetics of Caffeine: A Systematic Analysis, Front Pharmacol 2021 (liver disease)
- Drake C et al., Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed, J Clin Sleep Med 2013
- USDA FoodData Central: brewed coffee, espresso, black tea, green tea, cola
This calculator and article are for general information and aren’t medical advice. The model is a simplification and your own response to caffeine may differ. If you are pregnant, take medication or have a liver or heart condition, ask your doctor how much caffeine is right for you.
Embed this calculator
Share this guide
See more Coffee Informer on Google. Add us as a preferred source and our guides show up more in your Top Stories and AI results.
Add as a preferred source on Google
