Health & Wellness

Caffeine and sleep: when to have your last coffee

How caffeine affects sleep, why its long half-life means an afternoon coffee still bothers your night, and how to find your personal caffeine cutoff time.

Caffeine is the world’s favorite performance enhancer, and also one of the most common hidden causes of bad sleep. The problem is not just whether it keeps you awake, but that it lingers far longer than most people realize.

The short version: caffeine has a half-life of about five hours, so an afternoon coffee can still be working at bedtime. Stop by early afternoon, and cut off earlier if you are sensitive.

Why caffeine’s half-life matters

Half-life is how long it takes your body to clear half of a dose. For caffeine it averages about five hours. So if you have a coffee with 100mg of caffeine at 3pm, roughly 50mg is still active at 8pm, and 25mg at 1am. That residual caffeine is enough to affect a lot of people’s sleep.

This is why the timing of your last coffee matters more than the amount. A large coffee at breakfast is usually fine; a smaller one at 4pm can quietly wreck your night.

It hurts sleep even when you fall asleep

Here is the sneaky part. Caffeine can reduce your deep sleep, the restorative stage, even when it does not stop you from dropping off. So you sleep the hours, feel like you slept, and still wake up groggy and reach for, yes, more caffeine. It becomes a loop: poor sleep drives caffeine, caffeine worsens sleep.

Find your cutoff time

A reliable rule of thumb is no caffeine after early afternoon, about eight hours before bed. But your ideal cutoff depends on how fast you metabolize caffeine, which varies a lot between people. The caffeine calculator estimates how much caffeine is still active at your bedtime based on your drink and timing, and tells you the latest time to have your last one. It is the fastest way to see whether that 3pm cold brew is the reason you are staring at the ceiling.

Watch the hidden sources

Coffee is obvious, but caffeine hides in tea, energy drinks, cola, pre-workout, chocolate, and some medications. If you are cutting off in the afternoon, remember to count those too.

Fit it into the bigger picture

Cutting caffeine earlier is one of the highest-return sleep habits, but it works best alongside a consistent schedule and a calm wind-down, covered in how to fix your sleep and sleep cycles and the best time to wake up.

To see what actually helps you, track it. Our better sleep planner logs your caffeine cutoff alongside your sleep quality, so you can see the connection for yourself. Start by checking your cutoff with the caffeine calculator.

This guide is general information, not medical advice.

Frequently asked questions

How long before bed should I stop drinking caffeine?

Because caffeine has a half-life of about five hours, a common rule is to stop by early afternoon, roughly eight hours before bed. Sensitive people or slow metabolizers may need to cut off even earlier.

Does caffeine affect sleep even if I fall asleep fine?

Yes. Caffeine can reduce the amount and quality of deep sleep even when it does not stop you falling asleep, so you get the hours but wake unrefreshed. That is why an evening coffee can leave you tired the next day despite a full night.

How long does caffeine stay in your system?

With a half-life around five hours, about half of a dose is gone after five hours and a quarter after ten. It varies widely by person, from roughly 1.5 to 9.5 hours, based on genetics, medications, and other factors.


Ecuato builds interactive dashboard planners as single offline HTML apps. Browse all planners or visit the Etsy shop.