Sleep & Energy
Caffeine and Sleep: When to Have Your Last Coffee
Caffeine and sleep: how its long half-life, the 6 to 8 hour cutoff and adenosine work, why sensitivity varies, and a table of caffeine in common drinks.
Key takeaways
- Caffeine has a long half-life. Around 5 to 6 hours after a coffee, half the dose is still in your body.
- Stop 6 to 8 hours before bed. A lab study found 400 mg six hours before bed still cut sleep by over an hour.
- It works by blocking adenosine. Caffeine masks the sleep pressure your brain builds through the day.
- Sensitivity varies a lot. Genetics, age, medication and habit change how strongly caffeine hits you.
- Know your sources. Coffee, energy drinks, tea, cola and even chocolate add up across a day.
Caffeine and sleep sit in direct conflict: caffeine has a half-life of about 5 to 6 hours, so an afternoon coffee is still partly active at bedtime. To protect your sleep, have your last caffeine 6 to 8 hours before bed. Caffeine works by blocking adenosine, the molecule that signals how tired you are, so it hides your sleepiness rather than removing it. How strongly it affects you depends heavily on your own sensitivity.
The long half-life of caffeine
The half-life of a substance is the time your body takes to clear half of it. For caffeine in a typical healthy adult, that is roughly 5 to 6 hours. The practical consequence is that caffeine lingers far longer than its noticeable buzz. If you drink a coffee with 200 milligrams at 4 p.m., about 100 milligrams is still circulating at 9 or 10 p.m., and a quarter of it past midnight.
That slow clearance is why an innocent-seeming afternoon cup can quietly wreck a night. And the half-life is not fixed: it is longer during pregnancy and with some medications and liver conditions, and shorter in regular smokers. For many people the usable rule is simple: caffeine from the afternoon is still working at bedtime.
The 6 to 8 hour cutoff
Because caffeine clears so slowly, timing matters more than most people assume. In a well-known controlled study, researchers gave people 400 milligrams of caffeine, roughly the amount in a large coffee, at different times before bed. Even taken a full 6 hours before bedtime, it reduced total sleep by more than an hour, and the people often did not realize their sleep had been affected.
That is the basis for the common advice to stop caffeine 6 to 8 hours before bed. If you go to sleep at 11 p.m., that means last call somewhere around 3 to 5 p.m. Sensitive people, older adults and those who do not drink caffeine regularly often need to stop earlier, sometimes by midday. Cutting off caffeine in good time is one of the core habits in our /sleep-hygiene/ guide, and it pairs naturally with the fixed wake time described in /how-to-stop-hitting-snooze/.
Adenosine: what caffeine actually blocks
To understand why caffeine is tricky, you have to know what it does in the brain. From the moment you wake, a molecule called adenosine accumulates. The more it builds up, the stronger your sleep pressure, the growing drive to sleep. By the end of a long day, high adenosine is a big part of why you feel ready for bed.
Caffeine happens to be shaped a lot like adenosine, so it slots into the same receptors and blocks them. Crucially, it does not remove the adenosine; it just stops your brain from reading it. The sleep pressure is still there, piling up behind the blockade. When the caffeine wears off, all of that registers at once, which is the afternoon crash. Caffeine borrows alertness against a debt it cannot pay.
Why sensitivity varies so much
Two people can drink the same espresso after dinner and have completely different nights. The main reason is genetic: variations in the genes controlling the liver enzymes that break down caffeine mean some people are fast metabolizers and others slow. Several other factors stack on top:
- Age. Older adults tend to clear caffeine more slowly and sleep more lightly.
- Habit. Regular consumers build some tolerance to the alertness effect, though the sleep disruption can persist.
- Medication and pregnancy. Both can dramatically lengthen caffeine's half-life.
- Body size and sex. These influence concentration and clearance to a smaller degree.
The takeaway is to treat the 6 to 8 hour rule as a starting point, then adjust to your own experience. If your sleep is light or broken, pulling your cutoff earlier is one of the easiest experiments you can run.
Source versus caffeine content
It is easy to underestimate your intake because caffeine hides in more than coffee. These are typical amounts; brands and serving sizes vary widely.
| Source | Typical caffeine (mg) |
|---|---|
| Brewed coffee, large (350 ml) | 150 to 200 mg |
| Espresso, single shot | 60 to 80 mg |
| Energy drink (250 ml) | 80 to 150 mg |
| Black tea (240 ml) | 40 to 70 mg |
| Green tea (240 ml) | 25 to 45 mg |
| Cola (330 ml) | 30 to 40 mg |
| Dark chocolate (30 g) | 15 to 25 mg |
| Decaf coffee | 2 to 5 mg |
For most healthy adults, up to about 400 milligrams a day is considered moderate, but where that caffeine falls in the day matters as much as the total. Three coffees before noon is very different from one at 5 p.m. It is also worth watching serving sizes: a single large takeaway coffee can carry more than the numbers above, and a strong energy drink can rival a double espresso. When you add up a day of small doses, many people are surprised how close to the limit they already sit.
Putting it together
You do not have to quit caffeine to sleep well. You have to respect its timing. Front-load it: enjoy it in the morning and early afternoon, when it helps most and clears before night. Set a personal cutoff based on your bedtime and your sensitivity, and count the hidden sources, especially tea, cola and energy drinks. If you want to plan a bedtime around full sleep cycles once the caffeine is out of the way, our /sleep-calculator/ handles the math.
Caffeine does not give you energy. It blocks the signal telling you how tired you are, and the bill always comes due. Drink it early, and you get the lift without paying for it with your sleep.
Frequently asked questions
How long before bed should I stop drinking caffeine?
A safe default is to have your last caffeine 6 to 8 hours before bedtime. In a controlled study, 400 milligrams of caffeine taken even 6 hours before bed still reduced total sleep time by more than an hour. People who are sensitive, older, or not regular consumers may need to stop earlier, in some cases by midday.
What is the half-life of caffeine?
The half-life of caffeine is roughly 5 to 6 hours in a typical healthy adult, meaning that is how long it takes your body to clear half of a dose. So if you drink a coffee with 200 milligrams at 4 p.m., around 100 milligrams is still active at about 9 or 10 p.m. The half-life is longer in pregnancy and with certain medications, and shorter in regular smokers.
How does caffeine keep you awake?
While you are awake, a molecule called adenosine builds up in the brain and creates sleep pressure, the growing urge to sleep. Caffeine has a similar shape and blocks adenosine's receptors, so your brain stops registering how tired it actually is. The adenosine is still accumulating; caffeine just hides it, which is why you can crash when it wears off.
Why does caffeine affect some people more than others?
Sensitivity is largely genetic: variations in the genes that control how fast your liver breaks down caffeine mean some people clear it quickly and others slowly. Age, pregnancy, medications, smoking and how regularly you consume caffeine all shift your response too. This is why the same evening espresso ruins one person's sleep and not another's.
Does caffeine affect sleep even if I can fall asleep fine?
Yes. Even when caffeine does not stop you falling asleep, it can reduce the amount of deep, slow-wave sleep and make your sleep lighter and more fragmented. You may not notice, but you can wake less refreshed. This is one reason people underestimate how much their late-day caffeine is costing them.
Sources
- Drake C. et al. Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed. Journal of Clinical Sleep Medicine, 2013. doi.org/10.5664/jcsm.3170
- Sleep Foundation. Caffeine and Sleep. 2023. www.sleepfoundation.org/nutrition/caffeine-and-sleep
- U.S. Food and Drug Administration. Spilling the Beans: How Much Caffeine is Too Much? 2024. www.fda.gov/consumers/consumer-updates/spilling-beans-how-much-caffeine-too-much
- MedlinePlus (NIH). Caffeine. 2023. medlineplus.gov/caffeine.html
- Mayo Clinic. Caffeine: How much is too much? 2024. www.mayoclinic.org/healthy-lifestyle/nutrition-and-healthy-eating/in-depth/caffeine/art-20045678
This article is for general information and does not replace advice from a doctor. If you have persistent sleep or health problems, consult a qualified professional.