The short answer

Caffeine blocks adenosine, the chemical that builds sleep pressure, and its effects last for hours: about half is still in your body 5 hours later. In a home trial, a strong dose taken 6 hours before bed still significantly disturbed sleep. The NHS advises no tea or coffee for at least 6 hours before bed, and sensitive people may need to stop earlier.

Strong evidence

Several good randomised trials or a solid review of them agree, or very large long-term studies are backed by trials. How we grade

On this page
  1. How does caffeine keep you awake?
  2. How long does it last?
  3. What did the trial find?
  4. How much caffeine is in common drinks?
  5. What should you do?
  6. Common questions
  7. References

How does caffeine keep you awake?

While you’re awake, a chemical called adenosine builds up in the brain and makes you feel progressively sleepier. That is sleep pressure, one of the two systems that control sleep. Caffeine fits into the same receptors as adenosine and blocks them, so the signal doesn’t get through. You feel more alert, but the adenosine is still there, which is why tiredness often floods back as caffeine wears off.

How long does it last?

Caffeine’s half-life in healthy adults is typically around 5 hours, though it ranges widely, from about 2 to 10 hours, depending on genes, smoking (which speeds it up), pregnancy and the contraceptive pill (which slow it down) and some medicines. So if you drink a coffee with 100 mg of caffeine at 4pm, roughly 50 mg could still be active at 9pm.

What did the trial find?

Researchers in Detroit gave 12 healthy good sleepers a 400 mg caffeine pill, about the amount in four mugs of instant coffee or two large coffee-shop coffees, at bedtime, 3 hours before or 6 hours before, and a placebo on other nights, in random order. People slept at home with a sleep monitor.

Caffeine at all three times significantly disturbed sleep compared with placebo, including when taken 6 hours before bed. The authors concluded that caffeine taken 6 hours before bed “has important disruptive effects on sleep”, which supports the usual advice to avoid substantial caffeine for at least 6 hours before bedtime. It was a small trial with a high dose, but it fits a large body of lab research.

People often don’t notice the effect. Caffeine tends to reduce deep sleep and make sleep lighter even when you fall asleep without difficulty.

How much caffeine is in common drinks?

Drink Approximate caffeine
Mug of filter coffee 140 mg
Mug of instant coffee 100 mg
Mug of tea 75 mg
Can of energy drink (250 ml) 80 mg
Can of cola 40 mg
50 g bar of plain chocolate under 25 mg

Figures from the NHS. Coffee-shop coffees vary a lot and a large one can contain well over 200 mg.

What should you do?

  • Have your last caffeinated drink at least 6 hours before bed, and earlier if you sleep badly.
  • Count tea, cola, energy drinks, pre-workout supplements and some painkillers (some contain caffeine).
  • If you rely on caffeine to get through the afternoon, that may be a sign you’re not getting enough sleep.
  • Cutting back sharply can cause headaches for a few days. Reduce gradually if you drink a lot.

Keep reading

Common questions

What time should I stop drinking coffee?

At least 6 hours before bed, so about 4pm if you go to bed at 10pm. If you are sensitive to caffeine, sleep badly or drink strong coffee, stop by lunchtime. Some people can drink coffee late and sleep, but trials show caffeine still changes their sleep even when they don't notice.

Does decaf affect sleep?

Very little. Decaffeinated coffee still contains a small amount of caffeine, usually a few milligrams per cup, which is unlikely to matter unless you drink a lot of it late in the evening.

Is tea better than coffee for sleep?

A mug of tea has less caffeine than a mug of coffee, roughly 75 mg against 100 to 140 mg, but it's the total that counts. Several mugs of tea in the evening can add up to as much as a strong coffee. Herbal teas such as chamomile and rooibos are caffeine-free.

How much caffeine is safe?

For most healthy adults, up to about 400 mg a day is considered safe. If you are pregnant, the NHS advises no more than 200 mg a day.

References

  1. Drake C et al. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine, 2013.pubmed.ncbi.nlm.nih.gov
  2. NHS. Insomnia: how you can treat insomnia yourself.nhs.uk
  3. NHS. Foods to avoid in pregnancy (caffeine content of drinks).nhs.uk
  4. Saper CB, Scammell TE, Lu J. Hypothalamic regulation of sleep and circadian rhythms. Nature, 2005.pubmed.ncbi.nlm.nih.gov

First published 4 November 2026. Spotted an error? Tell us and we'll correct it. Read our editorial policy.