400 mg of Caffeine Six Hours Before Bed Still Cost an Hour of Sleep: Find Your Caffeine Cutoff

Last updated:

In a 2013 sleep-lab study, caffeine taken six hours before bedtime cut measured sleep by more than an hour. Add your drinks and bedtime to see how much caffeine is still in your body when you lie down, and the latest time your last cup can be.

What six hours before bed actually leaves

In a 2013 study in the Journal of Clinical Sleep Medicine, Christopher Drake and colleagues gave 12 healthy sleepers 400 mg of caffeine at bedtime, three hours before, or six hours before, on different nights. All three cut objectively measured sleep by 1.1 to 1.2 hours compared with placebo, including the six-hour dose. The participants mostly didn’t notice.

We ran that six-hour dose through the calculator with the Institute of Medicine’s average 5-hour half-life: 400 mg at 5 pm leaves about 174 mg in the body at 11 pm. To be under 100 mg by 11 pm, it would have had to be taken by 1 pm.

Most days look nothing like 400 mg at once. Here is what a few ordinary ones leave at an 11 pm bedtime, using EFSA’s typical values per serving (filter coffee 90 mg, espresso 80 mg, energy drink 80 mg, cola 40 mg):

Day Total Left at 11 pm Under 100 mg from
Coffee at 8 am and 3 pm, 5 h half-life 180 mg 41 mg 4:33 pm
Same, if you clear caffeine slowly (8 h) 180 mg 70 mg 6:48 pm
Same, if you clear it fast (3 h) 180 mg 17 mg 3:20 pm
Coffee at 8 am, espresso at 2 pm, energy drink at 4 pm 250 mg 65 mg 7:50 pm
One 300 mg coffee-shop drink at 2 pm 300 mg 86 mg 9:55 pm
400 mg at 5 pm (the Drake six-hour dose) 400 mg 174 mg 3:00 am

The half-life row is the one to notice. The same two coffees leave four times as much caffeine at bedtime for a slow metaboliser as for a fast one, and the IOM puts the normal range at 1.5 to 9.5 hours. If afternoon coffee keeps you up and it doesn’t seem to bother your partner, that may be the reason. How far back the cutoff needs to be at each half-life is worked out in a table: one coffee needs 2.5 to 6.8 hours to drop under 50 mg.

The 100 mg line is a reference point, not a safe level: EFSA’s 2015 opinion says single doses of 100 mg may affect sleep in some adults, particularly close to bedtime. Drake’s participants lost an hour of sleep with roughly 174 mg still in their bodies. Lower the line if you are sensitive.

How the math works

Caffeine is cleared at a roughly constant rate relative to how much is left, so each drink halves every half-life:

  • Each drink at time t: mg × 0.5^((t − drink time) ÷ half-life)
  • Total: the sum over every drink so far
  • Under the line at: after the last drink the total is a single exponential, so the crossing time solves directly: last drink + half-life × log₂(total just after it ÷ line)
  • Latest last drink: keep the other drinks where they are and solve earlier drinks at bedtime + last drink × 0.5^((bedtime − t) ÷ half-life) = line for t

The amount includes caffeine still in your stomach. Absorption is fast (the IOM reports 99% absorbed within 45 minutes), so the curve jumps at each drink instead of rising over the first hour.

Not medical advice. Source on github.

Where this doesn’t apply

  • Pregnancy. Caffeine clears far more slowly in late pregnancy, and EFSA’s limit for pregnant women is 200 mg a day rather than 400. Talk to your doctor rather than relying on a curve.
  • Medication. Some medications change how fast caffeine is cleared, and oral contraceptives lengthen the half-life. Set it higher, or ask a pharmacist.
  • Coffee-shop sizes. The presets are EFSA’s typical servings (a 200 ml filter coffee). Larger cups and stronger brews hold more, so use Custom with the amount on the menu.
  • Tolerance. Regular drinkers often feel less alert from the same dose, but that doesn’t mean less of it is in their bloodstream at bedtime.
  • Sleep problems with other causes. Being under the line doesn’t rule out caffeine as a factor, and it doesn’t make other causes go away. Persistent insomnia is worth a doctor’s visit.

What to actually do

  1. Enter a normal day’s drinks with real times and the sizes you actually order.
  2. Look at the bedtime number with the default 5-hour half-life, then with 8 hours. If the slow case is well over the line, your last cup is probably too late.
  3. Move only the last drink earlier until the bedtime number drops under the line, and use that time as your cutoff for two weeks.
  4. Keep everything else the same in those two weeks, so you can tell whether the cutoff is what changed your sleep.
  5. If afternoon sleepiness is the reason for the late cup, the Sleep Impact calculator puts a number on what the short nights cost.