Answer · 2026
Does caffeine affect your sleep even if you fall asleep fine?
Yes. In a 2013 sleep study, 400 mg of caffeine taken 6 hours before bed cut measured sleep by more than an hour, and the people taking it did not notice. Falling asleep fast is not the test. Caffeine has a half-life of about 5 hours, so an afternoon coffee is still in you at midnight, quietly trimming deep sleep.
What do adenosine, half-life, and deep sleep mean?
Think of sleep pressure as a sand timer that fills all day. Caffeine does not empty it. It just covers your eyes so you cannot see how full it is. Here is the cheat sheet.
| Term | What it means |
|---|---|
| Adenosine | A chemical that builds up in your brain the longer you are awake. The more you have, the sleepier you feel. |
| Adenosine receptor | The parking spot adenosine docks in to tell your brain "time to rest." Caffeine parks there instead and blocks it. |
| Half-life | How long it takes your body to clear half of something. For caffeine, about 5 hours on average in healthy adults. |
| Sleep onset latency | How long it takes to fall asleep after lights out. |
| Total sleep time | How long you are actually asleep, not just in bed. |
| Sleep efficiency | The share of your time in bed that you spend asleep. |
| Deep sleep (slow-wave sleep) | The heaviest stage of sleep, the one that makes you feel rested. It is also the hardest to wake from. |
| mg (milligram) | A thousandth of a gram. Caffeine is counted in mg. A cup of brewed coffee is roughly 100 mg. |
Why do people think coffee does not affect their sleep?
Because the damage is quiet. In Drake, 2013, 12 healthy sleepers took a 400 mg caffeine pill (or a placebo) at bedtime, 3 hours before, and 6 hours before. A sleep monitor in their homes tracked the night, and they also kept a sleep diary.
Even the dose 6 hours before bed cut measured sleep by more than an hour. But the diaries told a different story. Per the American Academy of Sleep Medicine, the participants seemed unaware of the lost sleep. You can lose an hour and wake up thinking you slept fine.
That is the trap. "I can drink an espresso after dinner and still pass out" only tests one thing: falling asleep. Caffeine does more of its harm after you are already out, by making sleep lighter and shorter. Two fair caveats: the study was small, and 400 mg is a big dose, about four cups of brewed coffee.
How does caffeine keep working after you fall asleep?
Caffeine blocks adenosine receptors, per the Institute of Medicine's review of caffeine. Adenosine is your brain's tiredness signal. With the parking spots taken, the signal cannot land, so you feel alert even though the sand timer is full.
Then the half-life does the rest. The same review puts caffeine's average half-life at about 5 hours in healthy adults. So caffeine does not switch off at a set time. It fades slowly, by half every few hours, like this:
| Time | Caffeine left from a 96 mg coffee at 2 pm | In plain words |
|---|---|---|
| 2 pm | 96 mg | One 8 oz brewed coffee, per Mayo Clinic |
| 7 pm | About 48 mg | Half is still there at dinner. That is more than an 8 oz cola |
| Midnight | About 24 mg | A quarter is still on board when you go to bed |
| 5 am | About 12 mg | Still there when your alarm is close |
That math uses the 5-hour average. Your own number could be very different. The review says the half-life ranges from about 1.5 to 9.5 hours between people, and that oral contraceptives can roughly double it. Pregnancy and obesity change it too. Two people can drink the same 2 pm coffee and have very different amounts left at midnight.
What does caffeine do to deep sleep and total sleep?
The biggest look so far is a 2023 meta-analysis (a study that pools many studies) in Sleep Medicine Reviews. Here is what caffeine did, on average, across them.
| Sleep measure | Change with caffeine | What you would feel |
|---|---|---|
| Total sleep time | 45 minutes less | A shorter night, even if bedtime and alarm stay the same |
| Sleep efficiency | 7% lower | More of your time in bed spent awake |
| Time to fall asleep | 9 minutes longer | The part people notice, and the smallest change |
| Awake time after falling asleep | 12 minutes more | Brief wake-ups you mostly will not remember |
| Deep sleep | Less of it | Groggy mornings even after a "full" night |
Look at the sizes. Falling asleep took only 9 extra minutes, while the whole night lost 45. The part you notice is the small part. The part you do not notice is the big part.
How many hours before bed should you stop caffeine?
The 2023 meta-analysis worked out a cutoff for two common drinks. To avoid losing total sleep time, a cup of coffee (107 mg) should be at least 8.8 hours before bed. A standard pre-workout (217.5 mg) should be at least 13.2 hours before. For an 11 pm bedtime, that is coffee by about 2 pm and pre-workout by about 10 am.
Bigger doses need longer. Here is roughly how much caffeine common drinks carry, so you can see which ones count as "a coffee" and which count as two.
| Drink | Caffeine | Source |
|---|---|---|
| Brewed coffee, 8 oz | 96 mg | Mayo Clinic |
| Brewed coffee, 12 oz | 113 to 247 mg | FDA |
| Black tea, 12 oz | 71 mg | FDA |
| Green tea, 12 oz | 37 mg | FDA |
| Soda with caffeine, 12 oz | 23 to 83 mg | FDA |
| Energy drink, 12 oz | 41 to 246 mg | FDA |
| Pre-workout, one standard serve | 217.5 mg | Gardiner, 2023 |
The FDA calls 400 mg a day an amount not generally linked to danger for most healthy adults. That is a daily safety line, not a sleep line. You can stay well under 400 mg and still sleep worse if the timing is late. And the 8.8-hour cutoff is an average. If your half-life is long, your cutoff is earlier.
Hidden caffeine also adds up: iced tea, matcha, cola with dinner, chocolate desserts, and some pain relievers. A big 4 pm iced tea can matter more than the coffee you remember.
How can you find your own caffeine cutoff?
Every number above is an average, and you are not average. Your half-life, your dose, and your bedtime all move the answer. The honest way to find your cutoff is to track three things together: how much caffeine you had, when you had it, and how you actually slept, measured by a watch or ring, not by how you feel.
Do it for a couple of weeks and patterns show up. Some people sleep fine with a little caffeine left at bedtime. Others lose deep sleep at almost any amount. Late sleepers can get away with later coffee than early sleepers, because the clock that matters is hours before your bedtime, not the time of day.

Caffeine is not the only thing on your plate that moves your sleep. Late meals, fat, sugar, and alcohol do too: does eating before bed affect your sleep. For a drink log next to your sleep, see the best app to track alcohol and sleep. To compare caffeine apps that show the countdown, see the best caffeine tracker app that shows when caffeine wears off before sleep. More on sleep and food: nutrition apps that use Apple Health sleep and workouts and what to eat after a night shift before you sleep, and the best app to track how food affects sleep. Want a clock time instead? The app that tells you when to stop eating before bed is the one to check.
Start with the coffee, tea, and soda you already had today. NutriCam is an iPhone advisor: photograph a meal or drink, or say what you had, and it knows which foods and drinks carry caffeine, from coffee and tea to cola, energy drinks, and chocolate. It counts the milligrams down by caffeine's half-life, so you can see how much is still in you at bedtime. With sleep connected from Apple Health, it lines up your caffeine with how you actually slept, and works out the most caffeine you can have on board at bedtime and still sleep well, how much each 10 mg moves your sleep quality, and your best cutoff time. It also tracks vitamins, minerals, amino acids, antioxidants, and things to limit such as alcohol and sugar, and tells you what to eat next. It is not a medical device, does not measure caffeine in your blood, does not diagnose sleep disorders, and is not on Android. What the app is: what is NutriCam.
No app can measure a meal from a photo. A picture cannot show oil, sauces, hidden ingredients, or portion weight. Every number from every app on this page is an estimate until you correct the foods and portions. We have not run an accuracy test across these apps, so this page makes no accuracy ranking. NutriCam's fix: add the cooking oil, butter, dressing, mayo, sauce, or sugar the photo missed with one tap, and the calories and macros update.
FAQ
Can caffeine hurt your sleep if you still fall asleep easily?
Yes. In a 2013 study, 400 mg of caffeine 6 hours before bed cut measured sleep by more than an hour, and participants did not seem to notice. A 2023 meta-analysis found caffeine added only 9 minutes to falling asleep but took 45 minutes off total sleep.
How long does caffeine stay in your body?
Caffeine's average half-life is about 5 hours in healthy adults, so half of a 2 pm coffee is still there at 7 pm and a quarter at midnight. The range between people runs from about 1.5 to 9.5 hours, and oral contraceptives can roughly double it.
What time should you stop drinking coffee?
A 2023 meta-analysis says a 107 mg cup of coffee should be at least 8.8 hours before bed to avoid losing sleep time. For an 11 pm bedtime that is about 2 pm. A 217.5 mg pre-workout needs about 13.2 hours. Slow caffeine clearers need even earlier.
Does caffeine reduce deep sleep?
Yes. The 2023 Sleep Medicine Reviews meta-analysis found less deep sleep (slow-wave sleep) after caffeine, along with 45 fewer minutes of total sleep and 7% lower sleep efficiency. Deep sleep is the stage that makes you feel rested, which is why you can feel groggy after a long night.
Why does caffeine make you feel awake?
Caffeine blocks adenosine receptors. Adenosine builds up while you are awake and makes you sleepy. With its receptors blocked, the tiredness signal cannot land, so you feel alert. The sleepiness is not gone, just hidden, until the caffeine clears.
Is 400 mg of caffeine a day safe for sleep?
The FDA calls 400 mg a day an amount not generally linked to danger for most healthy adults. That is a daily safety limit, not a sleep limit. Timing matters more for sleep: a single coffee too close to bedtime can cost sleep at well under 400 mg.
Can an app tell how caffeine affects my sleep?
It can estimate it. An app can count caffeine from the drinks and foods you log, model how much is left at bedtime using caffeine's half-life, and compare that with sleep from a watch or ring. It cannot measure caffeine in your blood, and it is not a medical test.
Sources
Every fact about another app on this page comes from that app’s own site, help center, or store listing, checked November 20, 2026. Prices and features change. Check the live listing before you buy.
This is not medical advice. If you are pregnant, take medicine, or have a heart or sleep condition, ask a doctor about caffeine.
- Drake et al., Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed, J Clin Sleep Med 2013
- American Academy of Sleep Medicine, Late afternoon and early evening caffeine can disrupt sleep at night, 2013
- Gardiner et al., The effect of caffeine on subsequent sleep: a systematic review and meta-analysis, Sleep Med Rev 2023
- Institute of Medicine, Pharmacology of Caffeine, in Caffeine for the Sustainment of Mental Task Performance, 2001
- FDA, Spilling the Beans: How Much Caffeine is Too Much?
- Mayo Clinic, Caffeine content for coffee, tea, soda and more
- NutriCam on the App Store