Falling asleep easily does not tell you everything about coffee’s effect on your night. Dose and timing matter—and decaf offers a way to keep the cup you enjoy.
Suppose you finish dinner with an espresso. You enjoy its aroma, the slight bitterness, and the way it seems to complete the meal. You are not trying to stay awake. You simply like good coffee.
Four hours later, you go to bed and fall asleep without difficulty. The next morning, you feel reasonably rested.
Did the coffee affect your sleep?
Possibly. Falling asleep is only one part of sleeping well. Caffeine can change how long you sleep, how often you wake up, and how much time you spend in different sleep stages. Some changes may be measurable even when you do not notice them.
For a healthy adult who wants to protect sleep, keeping regular coffee to the morning or early afternoon is a reasonable starting point. Switching to decaf later can preserve much of the pleasure without most of the caffeine.
But there is no experimentally established last safe hour for everyone.
One controlled experiment found no statistically significant sleep deterioration after 100 mg of caffeine taken four hours before bedtime. A 400 mg dose, however, disturbed sleep even when consumed twelve hours before bed. [1]
That difference raises a more useful question than simply asking when to stop drinking coffee: how much caffeine is in your cup, and what does that amount actually do to your sleep?
Key Takeaways
- The dose matters. A large caffeine dose can disturb sleep even twelve hours before bedtime. Smaller doses may have less effect, but no experiment has established a universally safe cutoff.
- You might not notice every effect. Objective sleep recordings sometimes reveal changes that are absent from people’s overall ratings of sleep quality.
- You do not have to abandon coffee. Keeping caffeinated drinks earlier in the day and choosing good-quality decaf later are practical ways to reduce exposure.
Can coffee affect your sleep without you noticing?
Imagine two versions of the same night.
In the first, you go to bed, fall asleep, and wake up feeling normal.
In the second, a researcher records your brain activity throughout the night. The recording shows that you spent less time in deep sleep, even though your overall impression of the night is unchanged.
Both accounts could be accurate.
That was one of the revealing findings of an experiment by Carissa Gardiner and colleagues, published online in 2024 and appearing in the journal Sleep in 2025. [1]
The researchers studied 23 healthy young men who regularly consumed moderate amounts of caffeine. Each participant received either a placebo or a 100 mg or 400 mg dose of caffeine at different intervals before bedtime. The researchers recorded sleep at home, including brain activity, and collected the participants’ own assessments.
When participants took 400 mg twelve hours before bedtime, they spent approximately 21 minutes less in deep sleep than in the placebo condition. Their overall ratings of sleep quality, however, did not show a statistically significant deterioration at that interval.
At eight hours, objective disturbances were also detected, although some subjective measures did worsen. At four hours, the large dose produced problems that were apparent both in the recordings and in what participants reported.
This is an important distinction.
You may be completely accurate when you say that coffee does not prevent you from falling asleep. You may even feel rested in the morning.
But those experiences do not tell you everything about what happened during the night.
Falling asleep easily is not proof that caffeine left your sleep unchanged.
There is a limit to what this finding means. A measurable reduction in deep sleep during one experimental night does not automatically establish long-term damage to memory, health or everyday functioning. The researchers did not test those consequences.
What the experiment demonstrates is narrower, and more interesting: our perception of sleep does not always capture the changes that instruments can detect.
How much caffeine makes a difference?
The same experiment produced another striking result.
A 100 mg dose and a 400 mg dose behaved very differently.
What happened at different doses?
Dose changed the outcome
Caffeine taken 4, 8 or 12 hours before bed · Gardiner et al. [1]
Also delayed the onset of persistent sleep.
Also about 15 minutes less deep sleep.
Largest measured reduction in total sleep duration.
Selected statistically significant results compared with placebo in 23 healthy young men. These are different outcomes, not values on a single comparable scale. No significant effect detected is not evidence of no effect.
Reductions in total sleep time after 400 mg at eight and twelve hours were estimated but not statistically significant. [1]
At four hours before bed, the 400 mg dose reduced total sleep time by an estimated 50.6 minutes.
The 100 mg dose did not produce a statistically significant deterioration, even at that same four-hour interval.
That is encouraging if you enjoy a modest cup of coffee. But the study was small, included only young men, and could not rule out smaller effects. A result that is not statistically significant is not proof that the effect is zero.
And another controlled experiment complicates the picture.
What happens after just one evening coffee?
In 2012, researchers recruited 63 adults who considered themselves sensitive to caffeine. On different evenings, they drank either regular coffee containing 90 mg of caffeine or decaf containing 4.5 mg after dinner, without knowing which version they were receiving. [2]
After regular coffee, participants reported taking an average of 17 minutes longer to fall asleep. They also reported more nighttime awakenings and poorer sleep quality.
The caffeine dose was similar to the smaller dose in Gardiner’s experiment. Yet the results were different.
Does that mean one experiment was wrong?
Not necessarily.
The studies examined different people under different conditions. The dinner-coffee experiment specifically recruited caffeine-sensitive adults and relied on their reports. Gardiner’s trial recorded objective sleep in healthy young men.
A statistically significant result in one study and its absence in another do not establish that the true effects were different.
Still, the contrast challenges any simple rule claiming that a particular dose is harmless for everyone.
An earlier experiment by Christopher Drake and colleagues adds another piece. In 2013, researchers found significant sleep disruption after a single 400 mg dose taken at bedtime, three hours before bed or six hours beforehand. [3]
Together, these experiments point to a conclusion that is useful but not especially convenient: the amount of caffeine matters, the timing matters, and the person drinking it matters too.
Why does caffeine stay with you for so long?
Caffeine does not create energy. Its main alerting effect comes from blocking receptors for adenosine, a substance involved in regulating sleep pressure.
Sleep pressure is the increasing tendency to sleep after spending time awake. Caffeine interferes with that signal, making you feel less sleepy without removing the underlying need for sleep.
The effect can last long after the pleasure of drinking coffee has passed.
In healthy adults, caffeine has an elimination half-life of around five hours on average, although the actual value varies considerably. [4]
A simplified example shows what that means.
One coffee, many hours later
Suppose you drink 100 mg of caffeine at 5 p.m., and your caffeine half-life is five hours.
Caffeine remains long after the last cup
Illustrative example: one 100 mg dose, five-hour half-life
The coffee may be a distant memory by bedtime, but some of its caffeine can remain in your body well into the night.
That does not mean 50 mg remaining in your system will cost you a particular number of minutes of sleep. The relationship between caffeine concentration and sleep is more complicated.
Why can one person drink coffee at night while another cannot?
Part of the explanation lies in genetics.
The CYP1A2 gene helps determine the activity of an enzyme responsible for much of caffeine’s metabolism in the liver. Differences in its activity can influence how quickly caffeine is cleared.
But the rate of elimination is only part of the story.
Variations in another gene, ADORA2A, have been associated with differences in sensitivity to caffeine’s effects on sleep. This gene is involved in the adenosine-receptor system that caffeine acts upon. [5,6]
In other words, people can differ both in how their bodies handle caffeine and in how their brains respond to it.
That helps explain why the same cup may affect two people differently.
Genetics is not destiny, however. Smoking, medications, hormones and other physiological factors also influence caffeine metabolism. And the available evidence does not support a simple genetic test that can reliably tell everyone their last safe coffee time.
A person who sleeps easily after an evening espresso may genuinely be less sensitive. But falling asleep alone cannot establish that their sleep is completely unaffected.
Does drinking coffee every day make you resistant?
Anyone who drinks coffee regularly knows that its effects can change.
The first strong espresso after a long break may feel dramatically different from the same drink during an ordinary working week. Repeated caffeine exposure can produce adaptation. But does that adaptation protect sleep?
Researchers at the University of Basel investigated the question in 20 healthy young men who regularly consumed caffeine. [7]
Participants completed experimental periods involving caffeine, placebo or withdrawal. During the caffeine condition, they received 150 mg three times daily, a total of 450 mg. The final dose came eight hours before the measured night’s sleep.
After nine days of repeated caffeine exposure, conventional sleep measures, including total sleep time, the time needed to fall asleep and sleep-stage distribution, did not differ significantly between conditions.
That was a notable result.
The researchers did identify differences in certain electrical patterns of brain activity during sleep. But the clinical meaning of those changes remains uncertain.
The findings are compatible with adaptation to repeated daytime caffeine exposure.
They also raise another possibility: people who habitually drink substantial amounts of caffeine may partly be those who tolerate it well. Someone whose sleep is badly disrupted may have reduced their consumption years earlier.
That selection effect could resemble acquired tolerance without proving that tolerance caused it.
Gardiner’s experiment provides a useful contrast. Those participants also consumed caffeine habitually, yet a large additional dose still disturbed their sleep.
Being accustomed to coffee is not a guarantee that caffeine has stopped affecting you.
What happens when people drink coffee in ordinary life?
Laboratory experiments are good at isolating caffeine’s effects. But they do not always resemble a typical working day.
People drink different coffees, at different times, for different reasons. Someone may consume more caffeine because they slept badly the previous night.
That makes ordinary observational comparisons difficult. If coffee drinkers sleep less, did coffee cause the short sleep, or did short sleep cause the extra coffee?
The CRAVE trial tried to separate those explanations. [8]
Published in The New England Journal of Medicine in 2023, the trial randomly assigned 100 adults to periods when they were instructed to drink caffeinated coffee or avoid caffeine. Participants continued their normal lives while wearable devices recorded sleep and other outcomes.
Usable sleep data were available from 81 participants.
Coffee days versus caffeine-free days
| Randomized instruction | Average recorded sleep |
|---|---|
| Avoid caffeine | 7 hours 12 minutes |
| Drink caffeinated coffee | 6 hours 37 minutes |
The adjusted difference was approximately 36 minutes less sleep on coffee-assigned days, with a 95% confidence interval of 25 to 47 minutes less sleep.
Because participants experienced both conditions, the result is harder to explain simply by saying that people who enjoy coffee happen to have different sleep habits.
But the experiment had important limitations.
Participants knew whether they were supposed to drink coffee. The amount consumed and the time of the last cup were not standardized. Wrist-worn activity monitors cannot measure sleep as precisely as recordings of brain activity. Effects of caffeine and withdrawal may also have carried across days.
The study supports a causal effect of the coffee-drinking instructions on recorded sleep under ordinary living conditions.
It does not establish that one cup of coffee costs everyone 36 minutes of sleep.
Nevertheless, it adds an important dimension to the laboratory findings. Changing people’s coffee consumption changed how long they slept.
So how many hours before bed should you stop?
The familiar advice is to avoid caffeine for six hours before bedtime.
That is a useful warning, but it does not account for how much caffeine you consume.
The 2013 Drake experiment found sleep disruption after 400 mg even six hours before bed. The later Gardiner experiment detected effects of 400 mg at twelve hours, while finding no statistically significant deterioration after 100 mg taken four hours before bedtime. [1,3]
And then there is a surprisingly precise recommendation: 8.8 hours.
Where does the 8.8-hour rule come from?
In 2023, researchers published a systematic review and meta-analysis combining 24 studies of caffeine and subsequent sleep. [9]
Across the studies contributing to each outcome, caffeine consumption was associated with approximately:
- 45 minutes less total sleep
- 9 minutes longer to fall asleep
- 12 minutes more wakefulness after falling asleep
- 7 percentage points lower sleep efficiency
- Less time in deep sleep
These are pooled experimental estimates across different doses, schedules and participants. They are not predictions for a particular cup of coffee.
The researchers also developed a statistical model relating caffeine dose and timing to changes in total sleep time.
For a 250 ml coffee containing 107 mg of caffeine, the model produced an estimated cutoff of 8.8 hours before bedtime.
But that cutoff needs careful interpretation.
It was determined by the point where the model’s 95% confidence band crossed the zero-effect line. It was not the time at which the model predicted that caffeine had stopped affecting sleep.
We checked the published model coefficients. At 107 mg and 8.8 hours before bedtime, its central prediction still corresponds to approximately 12 minutes less sleep.
Research note: What does 8.8 hours actually mean?
The 2023 meta-analysis modelled how caffeine dose and timing relate to total sleep time. For 107 mg consumed 8.8 hours (528 minutes) before bedtime, its published rounded coefficients give:
21.02 − 0.05 × 528 + 0.16 × 107 = 11.74 minutes
The central estimate still suggests approximately 12 minutes less sleep. The 8.8-hour cutoff is where the model’s 95% confidence band reaches the zero-effect line, not where the predicted effect vanishes.
Our calculation checks rounded published coefficients, not participant-level data or the model’s uncertainty. It is not an individual safety threshold. [9]
That does not prove that everyone loses twelve minutes. It means that statistical uncertainty had become large enough that a reduction in sleep was no longer clearly established at that modelled boundary.
The underlying relationship was estimated from a limited and heterogeneous body of experiments. The exact 8.8-hour figure should not be mistaken for a validated biological deadline.
For someone seeking a cautious planning reference, finishing a modest coffee around nine hours before bedtime is reasonable.
But nine hours is not a guarantee of unaffected sleep, and the evidence for large doses supports substantially more caution.
How much caffeine is actually in your cup?
Scientists describe caffeine doses in milligrams. Coffee drinkers order espressos, cappuccinos and large mugs of filter coffee.
The difference matters.
A small espresso may contain less caffeine than a large filter coffee. A latte may contain one or two espresso shots. Adding milk or water changes the drink’s volume and concentration, not the total caffeine extracted into those shots.
Here are approximate reference values from Mayo Clinic and the US Food and Drug Administration. [10,11]
Drink Example serving Approximate caffeine Single espresso 30 ml 63 mg Double espresso 60 ml 126 mg Brewed coffee 237 ml 96 mg Cappuccino or latte 1–2 espresso shots 63–126 mg Instant coffee 237 ml 62 mg Decaf coffee 237 ml 2–15 mg Black tea 237 ml 48 mg Green tea 237 ml 29 mg Energy drink 237 ml About 79 mg Energy shot 60 ml Around 200 mg
These are reference examples, not guaranteed caffeine contents. Actual amounts depend on the beans, preparation, brand and serving size.
A large brewed coffee may contain much more caffeine than the reference serving. Cold brew and energy drinks can vary substantially, so checking the label or the producer’s information matters.
Tea, cola, chocolate, certain medicines and pre-workout supplements can also contribute to your daily caffeine intake.
The FDA cites 400 mg per day as an amount not generally associated with negative effects for most healthy adults. [11]
But that is not a sleep-protection threshold.
The controlled experiments show why. A single 400 mg dose can disturb sleep even many hours before bedtime.
Daily total intake and the timing of individual doses are different questions.
Can you keep the coffee and lose the caffeine?
If you love coffee, being told to avoid it after lunch can feel like a poor bargain.
Perhaps you care less about the stimulating effect than about the drink itself: freshly ground beans, a favourite roast, the preparation, the aroma, and the familiar espresso after dinner.
Decaf offers an alternative that preserves much of that experience.
And there is experimental evidence that the difference matters for sleep.
In the blinded dinner-coffee trial described earlier, the regular coffee contained 90 mg of caffeine and the decaf 4.5 mg. Participants reported worse sleep after the regular version. [2]
A much earlier laboratory experiment, conducted by Ismet Karacan and colleagues in 1976, compared regular coffee, decaf, isolated caffeine and warm water before bedtime. Regular coffee produced dose-related sleep disturbances, while decaf did not significantly alter the measured sleep characteristics. [12]
That study involved only 18 men and was partly supported by General Foods Corporation. It cannot establish that every coffee drinker will respond in the same way.
Taken together, however, these experiments support caffeine as a principal contributor to regular coffee’s acute effects on sleep.
Replacing a late regular coffee with decaf may therefore help, particularly if you are sensitive to caffeine.
It does not cure insomnia or eliminate every possible influence on sleep.
Can decaf still taste like excellent coffee?
Yes. Decaf does not have to be instant coffee or an inferior substitute.
You can buy decaffeinated whole beans, grind them fresh and brew them using the same equipment as regular specialty coffee.
Most commercial decaffeination happens before roasting, while the beans are still green. Several technologies are used to remove caffeine while preserving as much of the coffee’s flavour potential as possible. [13]
Decaffeination process How it works What it tells you Sugarcane / ethyl acetate (EA) A solvent extracts caffeine from prepared green beans The extraction method, not a guarantee of flavour Swiss Water Water-based coffee extract and carbon filtration remove caffeine No direct organic-solvent extraction CO₂ Pressurized carbon dioxide selectively extracts caffeine A different extraction method, not a quality ranking Methylene chloride A solvent selectively removes caffeine The processing method, not the taste of the finished coffee
None of these processes guarantees the best taste.
Coffee origin, the quality of the green beans, processing, roasting and brewing may matter as much as the decaffeination method itself.
For someone who enjoys specialty coffee, the solution is reassuringly ordinary: choose a roaster you trust and experiment.
If you prefer bright, fruity filter coffee, look for decaf beans with similar tasting notes. If you enjoy a rich, chocolate-forward espresso, select a roast suited to that style.
Buy a small bag first. A disappointing decaf is a reason to try another one, not to abandon the idea.
One qualification matters, especially for very caffeine-sensitive drinkers: decaf is not completely caffeine-free.
The FDA gives a typical range of 2–15 mg per 237 ml cup. [11]
For most coffee drinkers, that represents a substantial reduction compared with regular coffee.
Choosing your last coffee of the day
Suppose you usually go to bed at 11 p.m.
You enjoy two coffees in the morning, another after lunch and sometimes an espresso after dinner.
What should you actually change?
Begin with the amount of caffeine rather than the number of drinks. Two small espressos and two large mugs of filter coffee are not equivalent exposures.
If sleep is a priority, keeping regular coffee to the morning or early afternoon is a reasonable first choice.
For an 11 p.m. bedtime, finishing a roughly 100 mg coffee around 2 p.m. gives nine hours before sleep. That is close to the meta-analysis’s 8.8-hour model estimate, but it is a planning reference, not an experimentally demonstrated safe boundary.
If you consume large caffeine doses, consider shifting them substantially earlier or reducing them. A single 400 mg dose affected objective sleep measures even twelve hours before bedtime in the controlled trial.
If you love an evening espresso, replace it with a well-chosen decaf. You can keep the beans, the grinder, the preparation and much of the pleasure.
If you regularly consume considerable amounts of caffeine, reduce gradually rather than stopping abruptly. Withdrawal can cause headaches, fatigue and other unpleasant symptoms. [11]
You can also experiment with your own routine. Keep your bedtime reasonably consistent, change your afternoon caffeine intake for a sustained period, and pay attention to sleep duration, awakenings and daytime functioning. Avoid changing several other habits at the same time.
Such a comparison can be useful, especially if you notice a clear improvement. But it is not a blinded experiment, and feeling unchanged does not prove that every aspect of your sleep is unchanged.
Persistent sleep difficulties deserve attention even after changing your caffeine habits.
These recommendations concern generally healthy adults. Pregnancy, medications and certain medical conditions can change how the body handles caffeine. The adult experiments discussed here should not be used to establish caffeine limits for children or adolescents.
What the evidence actually tells us
The studies do not all measure the same thing. Looking at them together helps separate well-supported conclusions from tempting oversimplifications.
| Question | What the evidence shows | What remains uncertain |
|---|---|---|
| Can caffeine reduce sleep? | Controlled studies and a meta-analysis show reductions in sleep duration and changes in sleep structure. [1,3,9] | The effect of a particular cup on a particular person |
| Does dose matter? | A controlled trial found clear disturbances after 400 mg, but no significant deterioration after 100 mg. [1] | The exact threshold for each individual |
| Can the effect go unnoticed? | Objective sleep changes sometimes occurred without a significant change in overall perceived sleep quality. [1] | The long-term health importance of those particular changes |
| Does regular use create tolerance? | Some experiments are compatible with adaptation. [7] | How much is true adaptation rather than selection of tolerant drinkers |
| Can decaf help? | Controlled comparisons found better reported sleep after evening decaf than after regular coffee in caffeine-sensitive adults. [2] | How much benefit an individual will notice |
There is no single number that resolves every question about coffee and sleep.
The most important distinction is between evidence that caffeine can disturb sleep and a prediction that it will disturb yours by a particular amount.
The first conclusion is well supported. The second depends on dose, timing, physiology and individual sensitivity.
The coffee may be gone, but the caffeine may not be
Return to that espresso after dinner.
Perhaps you drink it for the flavour, not the alertness. Perhaps you fall asleep easily and never think about it again.
The research does not establish that your evening espresso is damaging your sleep.
It does show why falling asleep easily cannot settle the question.
A large dose can alter sleep many hours later. Smaller doses may have less effect, and some changes may escape your notice. The exact last safe hour remains unknown.
Fortunately, you do not need that number to make a useful choice.
You can keep the espresso ritual without necessarily keeping the caffeine.
References
- Gardiner CL et al. (2025; published online October 2024). Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep, 48(4), zsae230.
https://doi.org/10.1093/sleep/zsae230 - Lloret-Linares C et al. (2012). Does a single cup of coffee at dinner alter the sleep? A controlled cross-over randomised trial in real-life conditions. Nutrition & Dietetics, 69(4), 250–255.
https://doi.org/10.1111/j.1747-0080.2012.01601.x - Drake C et al. (2013). Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed. Journal of Clinical Sleep Medicine, 9(11), 1195–1200.
https://doi.org/10.5664/jcsm.3170 - Nehlig A. (2018). Interindividual Differences in Caffeine Metabolism and Factors Driving Caffeine Consumption. Pharmacological Reviews, 70(2), 384–411.
https://doi.org/10.1124/pr.117.014407 - Kapellou A et al. (2023). Genetics of caffeine and brain-related outcomes: a systematic review of observational studies and randomized trials. Nutrition Reviews, 81(12), 1571–1595.
https://doi.org/10.1093/nutrit/nuad029 - Rétey JV et al. (2007). A genetic variation in the adenosine A2A receptor gene (ADORA2A) contributes to individual sensitivity to caffeine effects on sleep. Clinical Pharmacology & Therapeutics, 81(5), 692–698.
https://doi.org/10.1038/sj.clpt.6100102 - Weibel J et al. (2021). The impact of daily caffeine intake on nighttime sleep in young adult men. Scientific Reports, 11, 4668.
https://doi.org/10.1038/s41598-021-84088-x - Marcus GM et al. (2023). Acute Effects of Coffee Consumption on Health among Ambulatory Adults. New England Journal of Medicine, 388, 1092–1100.
https://doi.org/10.1056/NEJMoa2204737 - Gardiner C et al. (2023). The effect of caffeine on subsequent sleep: A systematic review and meta-analysis. Sleep Medicine Reviews, 69, 101764.
https://doi.org/10.1016/j.smrv.2023.101764 - Mayo Clinic. Caffeine content for coffee, tea, soda and more.
https://www.mayoclinic.org/healthy-lifestyle/nutrition-and-healthy-eating/in-depth/caffeine/art-20049372 - U.S. Food and Drug Administration. Spilling the Beans: How Much Caffeine Is Too Much?
https://www.fda.gov/consumers/consumer-updates/spilling-beans-how-much-caffeine-too-much - Karacan I et al. (1976). Dose-related sleep disturbances induced by coffee and caffeine. Clinical Pharmacology & Therapeutics, 20(6), 682–689.
https://doi.org/10.1002/cpt1976206682 - Pietsch A. (2017). Decaffeination: Process and Quality. In The Craft and Science of Coffee, pp. 225–243.
https://doi.org/10.1016/B978-0-12-803520-7.00010-4
Medical information
This article may contain published medical evidence, clinical context, personal observations, or hypotheses. These are not equivalent levels of evidence. See the Editorial & Medical Review Policy and Medical Disclaimer. This content is educational and does not provide an individual diagnosis or treatment plan.