In a crisis? Call or text 988  ·  In immediate danger, call 911 (US)  ·  Opening soon  ·  Refer a patient

Free tool

Caffeine cutoff calculator

Caffeine lingers far longer than its lift. Enter when you want to be asleep and this tool shows the latest sensible time for your last cup.

Medically reviewed by Shariq Refai, MD, MBA, FAPA, board certified psychiatrist · Last reviewed June 17, 2026 · Editorial policy

A warm cup of coffee on a table by a window in afternoon light, with a teal accent
TL;DR. Caffeine has a half-life of about five to six hours, so a meaningful amount is still active at bedtime if you drink it late. A cutoff eight or more hours before sleep protects deep sleep for most people, which is why it pairs naturally with the sleep calculator.
Quick overview. Enter the time you want to be asleep and the tool counts back to three cutoff times, from a cautious early stop to the latest you should reasonably push it. Remember it covers all caffeine, not just coffee.

The science

Why caffeine wrecks sleep hours later

Caffeine works by blocking adenosine, the molecule that builds up through the day and creates the pressure to sleep. Because your liver clears caffeine slowly, with a half-life around five to six hours, a 3 p.m. coffee can still have a quarter of its dose circulating near midnight. That residual caffeine keeps blocking the sleep signal even when you feel tired enough to drop off.

The effect isn't always obvious. Even when caffeine doesn't stop you falling asleep, studies find it reduces deep, slow-wave sleep and fragments the night, so you wake less restored without knowing why. Cutting it off well before bed removes that hidden tax.

Using it well

How to pick your cutoff

If you're caffeine-sensitive, sleep lightly, or are working on a sleep problem, lean toward the earlier cutoff. If you sleep soundly regardless, the later time may be enough. The recommended middle option, around eight hours before bed, suits most adults.

Sensitivity varies a lot between people, shaped by genetics, tolerance, pregnancy, and other medications. Treat the times as a starting point and adjust based on how you actually sleep over a week or two.

Beyond coffee

What counts, and what else helps

The calculator applies to total caffeine: coffee, espresso, black and green tea, energy drinks, many sodas, pre-workout, and even dark chocolate. A late espresso martini counts twice over. If you're tracking a sleep problem, it helps to notice all the sources, not just the morning cup.

Timing is one lever among several. A consistent wake time, morning light, and limiting alcohol close to bed often matter as much. Use this alongside the sleep calculator to line up both ends of the night.

Frequently asked questions

Good questions, clear answers

Is the 8-hour cutoff exact?

No. It's a practical average based on caffeine's long half-life. Sensitive people may need a wider gap; others tolerate caffeine later without obvious harm.

Does this include tea, soda, and chocolate?

Yes. Anything with caffeine counts toward your total, so the cutoff applies to all of it, not just coffee.

I fall asleep fine after coffee. Do I still need a cutoff?

Possibly. Late caffeine can lighten and fragment sleep even when it doesn't delay falling asleep, so you may wake less rested without realizing the cause.

What about decaf?

Decaf has a small amount of caffeine, usually low enough not to matter, but very sensitive people occasionally notice it. If in doubt, treat a late decaf cautiously.

Does caffeine affect anxiety too?

Yes. For some people caffeine increases anxiety, jitteriness, and a racing heart, and poor sleep can worsen mood, so the two often interact.

How is this different from the sleep calculator?

The sleep calculator finds good bedtimes or wake times by sleep cycles. This one finds the last safe time for caffeine. They're designed to be used together.

Is my data saved?

No. Everything is calculated in your browser and nothing is stored.

Related reading

shrinkMD offers board-certified telepsychiatry by secure video. See where we offer care and how care works.

Explore the Shrink Network

shrinkMD is part of a connected family of mental health resources. For more on this topic, explore:

Medical Disclaimer: This content is provided for general educational and informational purposes only. It is not medical advice, diagnosis, or treatment. Reading this content does not create a doctor-patient relationship with shrinkMD, Dr. Shariq Refai, or any affiliated clinician. Always seek the advice of a qualified healthcare professional regarding questions about a medical or mental health condition. Never disregard professional medical advice or delay seeking care because of something you have read on this website. If you are experiencing a medical or mental health emergency, call 911 or go to the nearest emergency room.

Sleep and mood tangled together?

shrinkMD provides licensed online psychiatric care for adults, including how sleep affects mood and anxiety. Join the waiting list and we'll reach out when booking opens.

Join Our Waiting List
Part of The Shrink Network

Independent, ad-free mental health education and wellness properties, founded and medically reviewed by our founder. Care happens here. Learning happens across the network.

If you are in crisis or need urgent assistance: Crisis Text Line: Text HOME to 741741 • National Suicide Prevention Hotline: 9-8-8
CallJoin Our Waiting List