I used to think coffee was a simple on and off switch. Drink a cup, feel awake for a few hours, done. Then I started tracking my sleep and noticed something annoying: a 3 p.m. latte was still messing with me at 11 p.m. So I went down the rabbit hole on caffeine timing, and the honest answer to how long coffee keeps you awake is more complicated than the label on the mug suggests.
The short answer: 5 to 6 hours for half, 10 or more for all of it
Caffeine has a half-life of roughly five to six hours in a healthy adult. That means if you drink 100 mg of caffeine at 2 p.m., about 50 mg is still floating around your bloodstream at 7 or 8 p.m. Another five or six hours after that, you're down to 25 mg. It takes four to five half-lives, so 20 to 30 hours, before the caffeine is essentially gone.
That last part surprises people. You don't need caffeine in your system to feel wired. You just need enough of it to nudge your adenosine receptors, and that can happen at levels well below the original dose.
If you want to run the numbers for your own body weight and timing, our caffeine half-life tool does the math for you. I plug in my afternoon cup whenever I'm tempted to order a second one.
Why your 4 p.m. coffee is still working at midnight
Caffeine doesn't give you energy. It blocks adenosine, the molecule that builds up in your brain all day and makes you feel sleepy. When caffeine occupies those receptors, adenosine can't do its job. Your brain keeps cruising.
Here's the catch. Adenosine doesn't stop building up just because caffeine is blocking it. It keeps accumulating in the background. So when the caffeine finally clears, all that piled-up adenosine hits you at once. That's why some people crash hard the day after a late coffee, even if they slept fine.
I learned this the hard way during a deadline week last spring. I was drinking cold brew at 5 p.m. to push through, falling asleep at 1 a.m., waking up groggy, and reaching for more coffee. It took me about four days to realize I had built a small sleep debt without noticing.
How long does coffee keep you awake? It depends on you
Five to six hours is the average. Your personal number can swing quite a bit.
- Genetics. Some people carry a variant of the CYP1A2 gene that makes them metabolize caffeine fast. Others are slow metabolizers and feel a single cup for eight hours or more.
- Medications and hormones. Oral contraceptives can slow caffeine clearance significantly. So can some antidepressants and antibiotics.
- Smoking speeds it up. Quitting can make you suddenly more sensitive to coffee.
- Pregnancy slows it down, often by half or more.
- Liver health matters, since that's where most caffeine gets broken down.
Age plays a role too. I'm in my late thirties and I can't drink coffee past 1 p.m. anymore without paying for it. At 25, I could have an espresso after dinner and sleep like a rock. That's not discipline, it's just biology changing.
A practical cutoff time
Most sleep researchers suggest stopping caffeine about eight to ten hours before bed. If you go to sleep at 11 p.m., that means your last cup lands around 1 or 2 p.m.
That sounds brutal. I know. But you don't have to quit cold turkey. Try moving your cutoff earlier by one hour per week. Your sleep cycle calculator can help you figure out when you actually need to be asleep, which makes the cutoff time less abstract.
One thing that helped me: I switched my afternoon cup to half-caf for two weeks, then decaf. The ritual stayed. The caffeine load dropped. I barely noticed the difference by day four.
What about espresso, cold brew, and tea?
Espresso gets a bad reputation, but a single shot has about 63 mg of caffeine. A 12 oz drip coffee has closer to 120 to 160 mg. Cold brew is the sneaky one. It's often 200 mg or more per serving because of the long steep and bigger pours.
Black tea sits around 40 to 70 mg. Green tea is lower, maybe 25 to 45 mg. Matcha can be higher than you'd expect because you're consuming the whole leaf.
Energy drinks are their own category. Some brands pack 300 mg into a can that goes down in ten minutes. That's a lot of caffeine hitting your system fast, and it will still be half active when you're trying to wind down.
How to recover when you've already overdone it
If you drank coffee too late and now you're staring at the ceiling, a few things actually help.
- Don't nap long. A 20 minute nap won't clear caffeine, but it can take the edge off without making things worse. Our nap calculator is useful here because it keeps you from oversleeping and wrecking the night further.
- Hydrate. Caffeine is a mild diuretic and dehydration makes restlessness worse.
- Get bright light in the morning. It anchors your circadian rhythm and helps you reset faster.
- Skip the next afternoon coffee, even if you're tired. That's the loop that keeps you stuck.
If you're dealing with jet lag on top of caffeine trouble, our jet lag calculator can help you plan light exposure and sleep windows so you're not fighting two problems at once.
What I actually do now
My rule is simple. No caffeine after 1 p.m. on weekdays. On weekends I'll sometimes push to 2 p.m. if I know I'm staying up later anyway. I keep a note on my phone with my last cup time, mostly because I forget and then blame my insomnia on stress when it's really the 4 p.m. flat white.
If you take one thing from this, take the math. Half of your coffee is still working five to six hours later. A quarter is still working ten to twelve hours later. That's the window you're playing with every time you pour a cup in the afternoon. Track it for a week with one of our free sleep tools and you'll see your own pattern faster than any article can tell you.