All calculators

When should you stop drinking coffee?

Caffeine Cut-Off Calculator: Last Coffee Before Bed

Sources checked · 3 sources · By Anthony Falcone

Before you start

  • If you are pregnant, keep caffeine to 200 mg a day at most. If you are breastfeeding, the safe amount is up to 200 mg. Talk to your midwife or doctor about anything above that.3
  • Talk to your doctor before using caffeine if you have heart rhythm problems, heart disease, high blood pressure, or an anxiety or panic disorder, or if you take medicine that interacts with it.
  • This calculator is for adults. EFSA found too little information to set a safe caffeine intake for children and teenagers.3

The calculator runs in your browser and needs JavaScript. Nothing you enter is sent or stored.

The short answer: To avoid losing sleep, have a cup of coffee (about 107 mg of caffeine) at least 8.8 hours before bed, and a typical pre-workout serving (about 217.5 mg) at least 13.2 hours before bed. Keep your total to 400 mg a day at most, or 200 mg if you are pregnant.1,3

How the calculator works

  • Cut-off times: a 2023 meta-analysis of 24 studies worked out how long before bed caffeine has to be taken so it doesn't shorten total sleep: at least 8.8 hours for a cup of coffee (107 mg per 250 mL) and at least 13.2 hours for a standard pre-workout serving (217.5 mg). The calculator subtracts that time from your bedtime.1
  • Why it matters: across those studies, caffeine cut total sleep by 45 minutes on average, took 9 minutes longer to fall asleep, and reduced deep sleep.1
  • Even 6 hours is not enough for a big dose: in a home study, 400 mg of caffeine disturbed sleep when taken at bedtime, 3 hours before and 6 hours before bed.2
  • Daily limits: up to 400 mg a day raises no safety concerns for healthy non-pregnant adults, and single doses up to 200 mg don't either. In pregnancy the limit is 200 mg a day. The calculator never shows more than 400 mg a day.3
  • Cups within your limit: the calculator divides your daily limit by the 107 mg coffee from the meta-analysis and rounds down: 400 ÷ 107 is 3 cups, 200 ÷ 107 is 1 cup.1,3

Example: with a bedtime of 23:00, 8.8 hours (8 h 48 min) earlier is 14:12, so that is the latest time for a cup of coffee. A pre-workout, 13.2 hours (13 h 12 min) earlier, would have to be before 09:48.1

How sure is this?

  • The cut-off times are averages from studies with different doses, people and ways of measuring sleep, so treat them as a starting point and adjust to how you sleep.1
  • The meta-analysis gives cut-offs for two doses only. For a drink with less caffeine than a cup of coffee, the coffee time is the nearest studied figure; for more than a pre-workout serving there is none.1
  • The home study tested one fixed dose, 400 mg, so it shows that 6 hours can be too short but not what cut-off a smaller dose needs.2

Common questions

How many hours before bed should I stop caffeine?

At least 8.8 hours for a cup of coffee (about 107 mg) and at least 13.2 hours for a typical pre-workout serving (about 217.5 mg), according to a 2023 meta-analysis of 24 studies.1

Is 6 hours before bed enough?

Not for a large dose. In a home study, 400 mg of caffeine taken 6 hours before bed still disturbed sleep compared with a placebo.2

How much caffeine a day is safe?

Up to 400 mg a day for healthy adults who are not pregnant, with single doses up to 200 mg. In pregnancy, up to 200 mg a day.3

How much caffeine is in an energy drink?

EFSA puts typical energy drinks at about 300–320 mg of caffeine per litre, so a 250 mL can holds about 75–80 mg (0.25 × 300 = 75, 0.25 × 320 = 80). Check the label: products differ.3

Sources

  1. Gardiner C, Weakley J, Burke LM, et al. The effect of caffeine on subsequent sleep: A systematic review and meta-analysis. Sleep Medicine Reviews, 2023. Meta-analysis. doi.org/10.1016/j.smrv.2023.101764
  2. 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. Randomised trial. doi.org/10.5664/jcsm.3170
  3. EFSA Panel on Dietetic Products, Nutrition and Allergies (NDA). Scientific Opinion on the safety of caffeine. EFSA Journal, 2015. Official reference values. doi.org/10.2903/j.efsa.2015.4102

Go further