Vintage alarm clock surrounded by coffee beans and a grinder in warm lighting, visualising the relationship between caffeine consumption and sleep timing
Sleep

Caffeine within 12 hours of bedtime harms sleep, often without you noticing

A randomized crossover trial in Sleep found that 400 mg of caffeine disrupts sleep when consumed within 12 hours of bedtime, while 100 mg is safe up to four hours before bed. Most participants could not tell when caffeine was harming their sleep.

By Margot Ellis8 min read
Margot Ellis
8 min read

A 2024 randomized crossover trial published in Sleep has produced the first evidence-based cutoff times for caffeine consumption before bed, and the headline finding is that the standard advice to avoid coffee after 2 p.m. may not go nearly far enough for anyone who drinks more than a single cup.

The trial, led by Carissa Gardiner and a team from Australian Catholic University and the Australian Institute of Sport, tested two doses of caffeine consumed at three different pre-bedtime intervals across 23 healthy male volunteers. A 100 mg dose, roughly one standard coffee, caused no detectable disruption to objective or subjective sleep at any timepoint, including as close as four hours before bed. A 400 mg dose, equivalent to about four coffees, three energy drinks, or two servings of a pre-workout supplement, significantly delayed sleep initiation, fragmented sleep architecture, and slashed deep sleep when consumed within 12 hours of bedtime. The effects worsened the closer consumption got to lights-out.

“A 100 mg dose of caffeine can be consumed up to 4 hours prior to bedtime,” the authors concluded, but “it is recommended to avoid consumption of 400 mg of caffeine as one dose within 12 hours of bedtime.”

The study fills a gap that has persisted despite decades of research establishing that caffeine harms sleep. A 2017 systematic review by Clark and Landolt in Sleep Medicine Reviews confirmed dose- and timing-response relationships across epidemiological studies and randomized trials, but no study had tested systematically varied doses and timings within a single controlled design. The Gardiner trial is the first to do so with in-home partial polysomnography, giving it both internal validity and real-world relevance.

How the study was designed

The trial used a placebo-controlled, double-blind, randomized crossover design in which each participant completed seven conditions: placebo, and 100 mg and 400 mg of caffeine consumed 12, 8, and 4 hours before their individualized bedtime. A 48-hour washout separated each condition, and participants adhered to a standardized habitual caffeine intake each morning, consuming no other caffeine sources throughout the 21-day intervention period.

Twenty-three men aged 25.3 plus or minus 5.0 years completed the protocol. The sample was restricted to males because, as the authors noted, accounting for hormonal profiles across the menstrual cycle would have substantially lengthened the trial. All participants were moderate caffeine consumers, averaging 112 mg per day with an inclusion ceiling of 300 mg per day. Sleep was measured with Somfit in-home partial polysomnography and electronic sleep diaries.

What 400 mg does to sleep architecture

The 400 mg dose produced clinically meaningful disruption across multiple sleep metrics, and the damage was not limited to the four-hour window that most people would intuitively avoid. Total sleep time fell by 50.6 minutes when 400 mg was consumed four hours before bed (p less than .001, Cohen’s d equals negative 0.36). At eight hours, the drop was 28.7 minutes, and at 12 hours, 30.0 minutes, though neither reached statistical significance for total sleep time alone. Sleep efficiency, however, was significantly reduced at both four hours (negative 9.5 percent, p less than .001) and eight hours (negative 6.9 percent, p equals .001), both exceeding the greater-than-5-percent threshold the authors defined as clinically meaningful.

Deep sleep took the hardest hit. N3, the slow-wave sleep stage essential for physical recovery and memory consolidation, dropped by 29.7 minutes at four hours (p less than .001, d equals negative 0.50, the largest effect size in the study), by 20.6 minutes at 12 hours (p equals .001, d equals negative 0.35), and by 15.3 minutes at eight hours (p equals .016). In percentage terms, N3 fell by 4.8 points at the four-hour mark. Light sleep, N1 plus N2, increased correspondingly, by 5.6 percentage points at four hours and 5.8 points at 12 hours.

Sleep fragmentation also increased. Wake after sleep onset, or WASO, rose by 29.1 minutes at eight hours (p equals .001) and by 26.2 minutes at four hours (p equals .002). Latency to persistent sleep, the time it takes to transition from dozing into sustained sleep, increased by 25.4 minutes at four hours (p less than .001) and remained elevated by 15.3 minutes at 12 hours (p equals .020). Both exceed the greater-than-10-minute clinical threshold.

100 mg passes clean

The 100 mg dose showed no significant effect on any sleep measure at any timepoint, including four hours before bed. Every comparison against placebo came back nonsignificant (p greater than .05). A single standard coffee clears fast enough that even late-afternoon consumption does not register on polysomnography.

The authors recommended that a 100 mg dose can be consumed up to four hours before bedtime without a negative impact on subsequent sleep. The finding is consistent with the Clark and Landolt review, which identified dose as the primary driver of sleep disruption. It also lines up with caffeine pharmacology: a half-life of three to five hours means a 100 mg dose is largely gone within the four-hour window.

The perception gap

Participants were surprisingly bad at judging whether caffeine was affecting their sleep. Perceived sleep quality dropped significantly only in the most extreme condition, 400 mg four hours before bed (negative 34.02 percent, p equals .006). At eight and 12 hours, despite objective polysomnography showing fragmentation and deep sleep loss, participants did not report feeling worse.

When asked to identify which condition they had been in, only 22 percent correctly identified both the dose and the timing. Roughly 44 percent got the dose right, and 36 percent got the timing right, numbers barely above chance for a seven-condition design. “The discrepancy between objective and subjective sleep quality,” the authors wrote, “suggests that individuals may have difficulty accurately perceiving the influence of caffeine on sleep quality.”

Someone who drinks a large afternoon coffee, a pre-workout supplement, or multiple energy drinks may be sleeping worse without realizing it. The objective damage accumulates while subjective awareness lags behind.

Clinically meaningful versus statistically significant

The authors defined four thresholds for what counts as clinically meaningful: latency to persistent sleep above 10 minutes, wake after sleep onset above 20 minutes, sleep efficiency below minus 5 percent, and total sleep time below minus 20 minutes.

The 400 mg dose crossed the latency threshold within 12 hours of bedtime. It crossed WASO and efficiency within eight hours. Total sleep time fell below the threshold only at four hours. The 100 mg dose crossed none of them.

A 25-minute increase in the time it takes to fall into sustained sleep is the difference between drifting off in 10 minutes and lying awake for 35. A 30-minute loss of deep sleep means losing the most restorative stage of the night entirely.

What the study does not answer

The sample was entirely male. The authors acknowledged this matters: hormonal profiles across the menstrual cycle would likely modulate caffeine’s effects on sleep, and the results may not transfer directly to women. The study also did not test any dose between 100 mg and 400 mg. Most real-world caffeine consumption falls in that gap. A person who drinks two afternoon coffees might experience no disruption or meaningful disruption, and this trial cannot say which.

Genotyping for CYP1A2, the gene that controls caffeine metabolism speed, and ADORA2A, linked to caffeine-induced sleep disruption, did not yield statistically significant interactions, but the authors noted the trial was underpowered for genetic analysis. Density plots suggested slow metabolizers experienced greater total sleep time reductions, a finding consistent with the Clark and Landolt review’s identification of adenosine-related genetic polymorphisms as moderators of individual sensitivity.

The trial was also conducted in habitual caffeine consumers with moderate intake. Whether caffeine-naive individuals or heavy users would respond differently is unknown. And while the 48-hour washout is standard for caffeine crossover trials, it is possible that longer-term adaptation or chronic sleep debt moderates the effects observed here.

What this means for your afternoon coffee

For anyone who drinks a single morning coffee, this study is reassuring. A 100 mg dose of caffeine, roughly one standard coffee, does not meaningfully disrupt sleep even when consumed as late as four hours before bedtime. The cutoff moves dramatically with dose. At 400 mg, equivalent to a large cold brew, a strong energy drink, or a pre-workout supplement, the safe window stretches to 12 hours. Consuming that amount at 2 p.m. means it is still active in the system at 2 a.m.

The perception finding adds a practical wrinkle: many people who think caffeine does not affect their sleep may simply be failing to notice the damage. If you consume more than 200 mg of caffeine per day, particularly in the afternoon, your sleep architecture may be compromised whether you feel fine in the morning or not.

References

  1. Gardiner CL, Weakley J, Burke LM, et al. Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. Sleep 48(4):zsae230. 2024. https://doi.org/10.1093/sleep/zsae230
  2. Clark I, Landolt HP. Coffee, caffeine, and sleep: A systematic review of epidemiological studies and randomized controlled trials. Sleep Medicine Reviews 31:70-78. 2017. https://pubmed.ncbi.nlm.nih.gov/26899133/
caffeinecircadian rhythmclinical trialcoffeesleepsleep-quality

Margot Ellis

Science writer covering sleep chronobiology, chronotypes, and the supplement-sleep intersection. Reports from London.