Caffeine Calculator
Caffeine has an average half-life of about 5 hours, so half of your afternoon coffee is still in your system at dinner. For a regular cup, research suggests stopping about 8 to 9 hours before bed. Enter what you drink and when you go to sleep to see your own cutoff time.
When should I have my last coffee?
Pick your drink and enter when you have it and when you go to bed.
Caffeine left at bedtime
27 mg
of 95 mg, 9 h before bed
Latest time for this drink
6:22 PM
4 h 38 min before bed
By bedtime you're under 50 mg, about half a cup of coffee, which this calculator treats as low enough for most people to sleep normally.
Uses first-order elimination with your chosen half-life. Caffeine amounts are typical values; brands vary widely, so check the label.
How long caffeine stays in your system
After you finish a drink, caffeine peaks in your blood within about an hour and then halves roughly every 5 hours. This is what a 95 mg cup of coffee at 2 PM looks like over the rest of the day:
| Time | Caffeine left |
|---|---|
| 2:00 PM | 95 mg |
| 7:00 PM | 48 mg |
| 9:00 PM | 36 mg |
| 11:00 PM | 27 mg |
| 12:00 AM | 24 mg |
| 2:00 AM | 18 mg |
Why some people need an earlier cutoff
The half-life varies a lot between people. Smoking roughly halves it, while pregnancy, oral contraceptives and a slower version of the liver enzyme CYP1A2 can double it or more. If coffee at lunch still keeps you up, pick the slow setting above. Sleeping poorly on caffeine most nights? Check whether it's adding up to sleep debt, and use the sleep calculator to pick a bedtime that ends on a full cycle.
More free sleep tools
Sleep Calculator
Best bedtime or wake-up time based on 90-minute sleep cycles.
Nap Calculator
When to set your alarm for a power nap or a full-cycle nap.
Sleep Debt Calculator
How much sleep you owe from the past week, and how to pay it back.
REM Sleep Calculator
When each REM period happens and how much REM sleep you get.
Jet Lag Calculator
How long jet lag lasts and how to shift your sleep before you fly.
Sleep Efficiency Calculator
What share of your time in bed you actually spend asleep.
Sleep Schedule Calculator
A day-by-day plan to fix your sleep schedule or adjust to daylight saving time.
Chronotype Quiz
Five questions to find out if you are a morning lark or a night owl.
Frequently asked questions
When should I stop drinking coffee before bed?
For a regular cup of coffee (about 95 mg), around 8 to 9 hours before bed. A 2023 review in Sleep Medicine Reviews by Gardiner and colleagues found that a typical cup should be finished about 8.8 hours before bedtime to avoid shortening sleep, and larger doses such as pre-workout drinks need even longer.
How long does caffeine last?
Caffeine has an average half-life of about 5 hours in healthy adults, so half of a dose is still in your body 5 hours later and a quarter after 10 hours. The half-life ranges from roughly 2 to 10 hours depending on genetics, smoking, pregnancy and some medications.
What is the half-life of caffeine?
About 5 hours on average. It is shorter in smokers and longer during pregnancy, in people taking oral contraceptives, and in people with slower liver metabolism of caffeine.
Can caffeine affect my sleep even if I fall asleep fine?
Yes. In a 2013 study by Drake and colleagues, 400 mg of caffeine taken 6 hours before bed cut total sleep by more than an hour as measured by a sleep monitor, even though participants did not report sleeping worse. Caffeine also reduces deep sleep.