Free tool · no sign-up

Caffeine calculator: when to stop coffee before bed

Add what you drank and when, and your bedtime. You get an estimate of the caffeine still in your body at bedtime, as a range, and the latest time for a coffee.

4hours

EFSA: about 4 hours on average in healthy adults, 2 to 8 hours across people.

Drinks today

For adults 18 and over. Amounts are typical servings: change the mg to match your cup or the label.

Estimated caffeine at 22:30

about 30 mg

Could be 6 to 75 mg, for a half-life of 2 to 8 hours. About what's in a cup of green tea.

Latest coffee for a 22:30 bedtime: 13:42.

A 2023 meta-analysis found that, to avoid losing total sleep, a coffee (107 mg in 250 mL) should be drunk at least 8.8 hours before bed. One drink of 50 mg or more is inside that gap (the closest, 8.5 hours before bed).

For the afternoon dip: a short guided rest you stay awake for.

A short reset for a stressful afternoon. Afternoon Slump Reset runs about 11 minutes. Voice: Thorne (synthetic). Don't listen while driving or operating machinery.

Play Afternoon Slump Reset

11 min · free · no account

How this calculator works

Caffeine leaves the body at a steady rate: every half-life, half of what is left is gone. The calculator applies that to each drink, from the time you drank it to your bedtime, and adds them up.

The half-life is the uncertain part. In healthy adults it averages about 4 hours, with a range of 2 to 8 (EFSA), so you get a range, not a single number. You can move the half-life yourself; the range always shows both ends.

It is an estimate, not a measurement. It counts each drink as taken in at once, and the caffeine in a real cup varies with the brew and the size.

What the research says

Caffeine within hours of bed costs sleepHolds up

A 2023 meta-analysis of 24 studies found that caffeine cut total sleep by 45 minutes and deep sleep by about 11 minutes, and added 9 minutes to falling asleep. To avoid losing total sleep, it put the last coffee (107 mg in 250 mL) at least 8.8 hours before bed. In a home study of 12 healthy sleepers, 400 mg taken 6 hours before bed cut sleep by more than an hour on a sleep monitor, although the sleepers' own diaries didn't pick it up. What this calculator can't know: your genes, your medicines, whether you smoke, and how much was really in your cup.

  1. 1.Gardiner C et al. (2023). The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Med Rev. PMID 36870101.
  2. 2.Drake C et al. (2013). Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med. PMID 24235903.
  3. 3.European Food Safety Authority (2015). Caffeine: EFSA explains risk assessment.
  4. 4.Parsons WD, Neims AH (1978). Effect of smoking on caffeine clearance. Clin Pharmacol Ther. PMID 657717.
  5. 5.Patwardhan RV et al. (1980). Impaired elimination of caffeine by oral contraceptive steroids. J Lab Clin Med. PMID 7359014.
  6. 6.Jeppesen U et al. (1996). A fluvoxamine-caffeine interaction study. Pharmacogenetics. PMID 8807660.
  7. 7.USDA FoodData Central (SR Legacy), checked 11 Oct 2026.
  8. 8.Antonio J et al. (2024). Common questions and misconceptions about caffeine supplementation. J Int Soc Sports Nutr. PMID 38466174.
  9. 9.US Food and Drug Administration. Spilling the beans: how much caffeine is too much?

Things that change the number

Smoking speeds it up. In one study the half-life was 3.5 hours in smokers against 6 in non-smokers (Parsons and Neims, 1978).

Some medicines slow it down. Women taking the contraceptive pill cleared caffeine more slowly in a 1980 study, 10.7 hours against 6.2 (Patwardhan and colleagues), and the antidepressant fluvoxamine stretched the half-life from 5 to 31 hours in a 1996 study (Jeppesen and colleagues). If you take a regular medicine, ask a pharmacist how it affects caffeine.

People differ. EFSA notes that the half-life varies widely from person to person, with medication and liver health among the reasons. That is why the answer is a range.

At a glance

Caffeine left at bedtime from brewed coffee (about 95 mg a cup), estimated at a 4-hour half-life, with the 2 to 8 hour range in brackets.
Drunk before bed1 cup2 cups3 cups
8 hours25 mg (6 to 50)50 mg (10 to 95)70 mg (20 to 145)
6 hours35 mg (10 to 55)65 mg (25 to 115)100 mg (35 to 170)
4 hours50 mg (25 to 65)95 mg (50 to 135)145 mg (70 to 200)

For a 22:30 bedtime, 8.8 hours before is 13:42.

Caffeine in common drinks

About this much caffeine per serving. Coffee-shop cups are often larger and stronger.
DrinkServingCaffeine
Brewed coffee8 fl oz (237 mL)about 95 mg
Espresso1 fl oz (30 mL)about 63 mg
Black tea8 fl oz (237 mL)about 47 mg
Green tea8 fl oz (237 mL)about 28 mg
Cola12 fl oz (355 mL)about 33 mg
Decaf coffee8 fl oz (237 mL)about 2 mg
Energy drink8 fl oz (237 mL)40 to 250 mg: check the label

USDA FoodData Central (SR Legacy), mg per 100 g worked out per serving, checked 11 Oct 2026. Energy drinks: Antonio and colleagues (2024).

Questions

What counts as one drink?+

It depends on the drink and the cup. As a guide, an 8 fl oz (237 mL) cup of brewed coffee has about 95 mg, a 1 fl oz espresso about 63 mg, a cup of black tea about 47 mg and a 12 fl oz can of cola about 33 mg (USDA FoodData Central). Coffee-shop cups can hold far more.

Is 700 mg of caffeine a day too much?+

It is well above the 400 mg a day that the FDA cites as an amount not generally associated with negative effects for most adults. If you regularly have that much, talk to a pharmacist or your GP.

How long before bed should I stop caffeine?+

A 2023 meta-analysis found that, to avoid losing total sleep, a coffee of about 107 mg should be drunk at least 8.8 hours before bed. If you clear caffeine slowly, the gap may need to be longer. Our caffeine half-life guide has the detail.

Read more