🌙 Better sleep starts tonight.Download Free on iOS →
Nutrition February 18, 2026 2 min read

Coffee and Sleep: How Long Before Bed Should You Stop Drinking Caffeine?

Caffeine affects your sleep more than you think. Learn exactly when to stop drinking coffee, how caffeine works, and why your afternoon cup might be the problem.

SleepBetter.ai

Sleep Science & Research

"Coffee doesn't affect my sleep — I can drink it at dinner and fall asleep fine." If this sounds like you, there's something important you should know: caffeine's biggest impact isn't on whether you fall asleep. It's on the quality of sleep you get once you're out.

How Caffeine Works

Caffeine blocks adenosine, a molecule that builds up in your brain throughout the day and creates sleep pressure. The more adenosine, the sleepier you feel. Caffeine doesn't eliminate adenosine — it just blocks the receptors, masking the tiredness signal. The adenosine is still accumulating behind the blockade.

When caffeine wears off, all that built-up adenosine hits at once — which is why caffeine crashes feel so sudden.

The Half-Life Problem

Caffeine's half-life is 5–6 hours for most people. That means if you drink a 200mg coffee at 3 PM, you still have 100mg in your system at 9 PM — roughly equivalent to a full cup of coffee.

But here's the part most people miss: the quarter-life is 10–12 hours. At midnight, you'd still have 50mg circulating. That's enough to significantly reduce deep sleep, even if you fall asleep on time and feel like you slept fine.

What the Research Shows

Studies using EEG monitoring show that caffeine consumed 6 hours before bed reduces total sleep time by over an hour and significantly decreases deep sleep percentage. Subjects often reported that they "slept fine" — but the objective data told a different story. You lose sleep quality without feeling it.

When to Stop: A Simple Rule

For most people, a noon to 2 PM cutoff provides a safe margin. If you're a slow metabolizer (you can test this genetically or just observe — does a single coffee keep you wired for 8+ hours?), move the cutoff to 10 AM.

The only way to know your personal threshold is to experiment and track. Try a strict noon cutoff for two weeks and compare your sleep quality to your baseline.

Hidden Caffeine Sources

It's not just coffee. Tea contains 25–50mg per cup. Dark chocolate has 12–25mg per ounce. Decaf coffee still has 7–15mg. Pre-workout supplements can contain 150–400mg. Some pain medications include caffeine. Even some ice cream flavors contain enough to matter if you're sensitive.

What to Drink Instead

After your caffeine cutoff, switch to herbal teas (chamomile, valerian, passionflower), water with lemon, or decaf if you enjoy the ritual. Rooibos tea tastes similar to black tea but is naturally caffeine-free.

The Two-Week Experiment

If you suspect caffeine is affecting your sleep, here's the test: maintain a strict noon cutoff for 14 days. Log your sleep quality, onset time, and morning energy every day. Compare to your previous two weeks. The data almost always makes the answer obvious.


SleepBetter.ai makes it easy to run experiments like this — log your sleep, track your habits, see the results. Available on iOS.

Key Questions Answered

  • Q.How Caffeine Works
  • Q.The Half-Life Problem
  • Q.What the Research Shows
  • Q.When to Stop: A Simple Rule
  • Q.Hidden Caffeine Sources

Your sleep coach is waiting

Personalized sleep plan, Apple Health analysis, guided breathwork — and a routine that runs itself. Free to start.

More Sleep Reads

Start tracking your sleep tonight

Start your personalized sleep plan

Answer a few questions, sync Apple Health, and SleepBetter.ai builds your roadmap to better sleep. Free to start.

Free forever. No credit card required.