Coffee Before Bed: How Caffeine Affects Sleep
That evening coffee may cost you more sleep than you think. Learn how caffeine affects sleep, how long it lasts and when to stop drinking it.

Key Takeaways
- Caffeine blocks adenosine, a brain chemical that builds up during the day and makes you sleepy.
- Caffeine's effects can last many hours; half of it may still be in your body 5 hours later.
- A large caffeine dose (400 mg) 6 hours before bed cut sleep by over an hour in one study.
- A research review suggests having your last cup of coffee at least 8 to 9 hours before bed.
- Tea, colas, energy drinks and chocolate also contain caffeine.
How Caffeine Keeps You Awake
From the moment you wake up, a chemical called adenosine slowly builds up in your brain. The more adenosine you have, the sleepier you feel, which is part of what makes you ready for bed at night. Caffeine works by blocking the receptors that adenosine acts on. The adenosine is still there, but your brain can't "hear" it properly, so you feel more alert than you really are.
This is helpful when you need to focus in the morning. At night, it's the opposite of what you want. Caffeine can make it harder to fall asleep, reduce the amount of deep sleep you get and make your sleep lighter and more broken.
How Long Does Caffeine Last?
Caffeine stays in your body far longer than most people realise. On average, its half-life, the time your body takes to clear half of it, is about five hours in healthy adults, though it can vary from a couple of hours to much longer. That means if you drink a strong coffee at 6 pm, a good share of that caffeine could still be in your system at 11 pm.
Many things change how quickly you clear caffeine. Genes play a part, which is why some people can drink coffee after dinner and sleep well while others lie awake after an afternoon cup. Pregnancy and some oral contraceptives slow caffeine clearance, while smoking speeds it up. Liver problems and certain medicines can also slow it down.
What the Research Says
In a well-known sleep study, adults took a high dose of caffeine (400 mg, roughly four cups of coffee) either right before bed, three hours before bed or six hours before bed. Even when it was taken six hours before bedtime, caffeine reduced total sleep time by more than an hour, measured with a sleep monitor at home. Interestingly, people often didn't notice how much their sleep had suffered.
A 2023 review that pooled results from many studies found that caffeine reduced total sleep time by about 45 minutes, made it take longer to fall asleep and reduced the amount of deep sleep. Based on the data, the researchers suggested that a standard cup of coffee should be drunk at least 8.8 hours before bedtime to avoid losing sleep. For someone who sleeps at 11 pm, that means finishing coffee by about 2 pm.
How Much Caffeine Is in Your Drinks?
Caffeine content varies widely with the type of drink, the brand and how it's made. A typical cup of brewed coffee contains roughly 80 to 100 mg, and large cups can contain much more. Strong South Indian filter coffee and espresso-based drinks can contain more, while instant coffee often contains a little less. A cup of black or milk tea, including chai, usually contains less caffeine than coffee, while green tea has less still. Cola drinks contain smaller amounts, but energy drinks can contain a lot. Dark chocolate contains a small amount too.
Health authorities such as the US Food and Drug Administration say that up to about 400 mg of caffeine a day is generally not linked with harmful effects in healthy adults. Pregnant women are usually advised to limit caffeine to 200 mg a day. But these limits are about overall safety, not sleep. Even a moderate amount at the wrong time can still affect your night.
Signs That Caffeine Is Hurting Your Sleep
You might be sensitive to caffeine if you find it hard to fall asleep, wake up often during the night, feel restless or have a racing mind in bed, or wake up tired even after a full night. Another clue is a cycle where you feel tired in the morning, drink more coffee to get going, then sleep poorly again. If any of this sounds familiar, try moving your last cup earlier and see if your sleep improves over a week or two.
What About Decaf?
Decaffeinated coffee isn't completely caffeine-free, but it contains only a small amount, usually just a few milligrams per cup. For most people, decaf in the evening is unlikely to affect sleep much, though very sensitive people may still notice a difference.
When Should You Have Your Last Cup?
A practical rule for most adults is to stop drinking coffee by early afternoon, around eight to nine hours before your usual bedtime. If you're very sensitive, you may need to stop even earlier or keep coffee to the morning only. If you're used to an evening cup, try switching to a caffeine-free option.
Better Drinks for the Evening
Good alternatives include warm milk, turmeric milk, chamomile tea, other caffeine-free herbal teas or simply warm water. Choose drinks without much sugar, and keep the amount small so you don't wake up to use the toilet.
Tips to Cut Back Without Headaches
If you drink a lot of coffee, stopping suddenly can cause headaches, tiredness and irritability. Cut back gradually by reducing one cup every few days or mixing regular with decaf. Drink plenty of water, and give yourself a week or two to adjust.
How Habuild Can Help
Habuild's live sessions combine yoga, exercise and breathing, which support better sleep. The Habuild app's Box Breathing habit is a calm way to relax before bed.
Editorial Sources
- Drake et al. – Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed, Journal of Clinical Sleep Medicine (2013)
- Gardiner et al. – The effect of caffeine on subsequent sleep: A systematic review and meta-analysis, Sleep Medicine Reviews (2023)
- US FDA – Spilling the Beans: How Much Caffeine Is Too Much?
- Sleep Foundation – Caffeine and Sleep
- ACOG Committee Opinion No. 462 – Moderate Caffeine Consumption During Pregnancy, Obstetrics & Gynecology (2010)
Health Disclaimer
This article is for general information only and is not medical advice. If you're pregnant, have a heart condition or have ongoing sleep problems, please consult a doctor about caffeine.






