Physical

Caffeine and Sleep: How Long Caffeine Lasts and When to Have Your Last Cup of Coffee

How long caffeine stays in your system, what the six-hour study found about coffee before bed, how much caffeine is in coffee, tea and energy drinks, and how to set a caffeine cutoff time that protects your sleep.

Updated October 15, 2026 · 7 min read

White ceramic mug with coffee on brown wooden table
Photo: @anniespratt on Unsplash

You had your last coffee at 4 p.m. You felt totally fine at bedtime. So why were you staring at the ceiling at midnight, wide awake and wondering what on earth was going on?

Caffeine works a lot longer than it feels like it does. Understanding exactly how long is one of the easiest, cheapest sleep fixes there is, and you don't have to give up your morning cup to do it. Let's walk through the science, the numbers in your favorite drinks and how to find the cutoff that works for you.

How long does caffeine stay in your system?

Caffeine has a half-life of roughly five hours in a typical healthy adult, though it ranges from about two to more than ten hours from person to person. Half-life means the time it takes your body to clear half of it.

Here's what that looks like in real life. Say you drink a coffee with 200 mg of caffeine at 4 p.m.:

  • 9 p.m.: about 100 mg still in your system, roughly a small cup of coffee
  • 2 a.m.: about 50 mg, around the amount in a cup of black tea
  • 7 a.m.: about 25 mg, still lingering when you wake up

It's like drinking a small coffee right before bed without meaning to.

Why caffeine affects some people more than others

Ever wonder why your friend can drink an espresso after dinner and sleep like a baby, while one afternoon tea keeps you up? Several things change how fast your body clears caffeine:

  • Genetics. Variations in a liver enzyme called CYP1A2 make some people fast metabolizers and others slow ones.
  • Pregnancy. Caffeine clearance slows a lot, especially later in pregnancy.
  • Hormonal birth control. Some oral contraceptives can roughly double caffeine's half-life.
  • Medications. Certain antidepressants and antibiotics slow caffeine breakdown. Ask your pharmacist if you're unsure.
  • Smoking. Smoking speeds caffeine clearance, so people who quit smoking often find coffee suddenly hits harder.
  • Liver health. Liver disease slows clearance.
  • Age. Some older adults find they're more sensitive to caffeine than they used to be.

How caffeine keeps you awake

Throughout the day, a chemical called adenosine slowly builds up in your brain. The more of it there is, the sleepier you feel. That's part of what's known as sleep pressure.

Caffeine has a sneaky trick. It fits into the same receptors adenosine uses and blocks them, so your brain doesn't get the "time to sleep" message. The adenosine is still there, waiting. When the caffeine finally wears off, it all hits at once, which is the famous caffeine crash.

The six-hour study: caffeine before bed steals sleep quietly

In a 2013 study published in the Journal of Clinical Sleep Medicine, researchers gave people 400 mg of caffeine (about the amount in three or four cups of brewed coffee) either right at bedtime, three hours before or six hours before. Even the dose taken six hours before bed cut total sleep by more than an hour.

Here's the really interesting part. At the six-hour mark, the sleep monitors picked up the lost sleep, but people's own sleep diaries mostly didn't. They didn't realize their sleep had been affected. Caffeine can steal sleep without you ever noticing the theft.

Caffeine also tends to reduce deep sleep, the most physically restorative stage. So even when you do fall asleep, your night can be lighter and less refreshing.

How much caffeine is too much?

The US Food and Drug Administration says up to 400 mg a day isn't generally linked with dangerous effects in healthy adults. That's a ceiling for safety, not a target, and it says nothing about timing. Two cups in the morning will affect your sleep very differently than two cups in the late afternoon.

Lower limits apply to some groups:

  • Pregnancy: the American College of Obstetricians and Gynecologists advises less than 200 mg a day
  • Teens: the American Academy of Pediatrics discourages energy drinks for children and teens
  • People with heart rhythm problems, anxiety or high blood pressure may need less. Ask your doctor.

How much caffeine is in coffee, tea and energy drinks?

Rough amounts (brands vary a lot):

  • Brewed coffee, 8 oz: about 80 to 100 mg
  • Large coffee-shop brewed coffee, 16 oz: often 300 mg or more
  • Espresso, one shot: about 60 to 75 mg
  • Cold brew, 16 oz: commonly 200 mg or more
  • Black tea, 8 oz: about 40 to 50 mg
  • Green tea, 8 oz: about 30 to 40 mg
  • Matcha, 1 teaspoon: about 60 to 70 mg
  • Cola, 12 oz: about 30 to 40 mg
  • Energy drinks: anywhere from 50 to over 300 mg, so check the label
  • Decaf coffee, 8 oz: usually 2 to 15 mg

Don't forget the hidden sources: dark chocolate, pre-workout powders, some "focus" gummies and certain pain relievers that contain caffeine. That afternoon chocolate bar adds up.

A glass mug filled with tea next to a bunch of flowers
Photo: @foodistika on Unsplash

What time should you stop drinking coffee?

A good starting point is no caffeine within 8 hours of bedtime. Some people do fine with 6, but given what the research found at six hours, 8 gives you a safer buffer.

Find your cutoff with this quick math:

  • Bedtime 10 p.m.: last caffeine by 2 p.m.
  • Bedtime 11 p.m.: last caffeine by 3 p.m.
  • Bedtime midnight: last caffeine by 4 p.m.

If you're sensitive or you're struggling with sleep, try a noon cutoff for two weeks and see what changes. Many people are amazed at the difference.

Caffeine and the tired-wired loop

Poor sleep makes you tired. Tired makes you reach for more coffee. More coffee late in the day makes your sleep worse. And round and round it goes.

Breaking the loop usually takes a few rough afternoons. When the 3 p.m. slump hits, try one of these instead of a refill:

  • A brisk 5 to 10 minute walk, ideally outside in daylight
  • A big glass of cold water (mild dehydration can feel like tiredness)
  • A short power nap of 10 to 20 minutes, if you can
  • A protein-rich snack, like yogurt or a handful of nuts
  • Swapping to decaf or herbal tea so you keep the ritual

Push through for a week or so, and your nights tend to improve. For the full picture, see how much sleep adults really need.

Caffeine and anxiety

Caffeine doesn't just keep you awake. In higher doses it can bring on a racing heart, jitteriness, sweaty palms and a sense of dread that feels a lot like anxiety. For people who already live with anxiety or panic attacks, it can make symptoms worse. Some people notice it after just one strong coffee, others only after three or four.

If you often feel on edge in the afternoon, try halving your caffeine for two weeks and see whether your mood settles. Our guide to natural ways to ease anxiety has more ideas. And anxiety at bedtime is its own sleep thief, so cutting caffeine can help twice over.

Does coffee dehydrate you?

Not really, for regular drinkers. Caffeine has a mild diuretic effect, but the water in a cup of coffee or tea more than makes up for it. Studies of habitual coffee drinkers have found that moderate amounts hydrate about as well as water. You can count your coffee toward your daily fluids, as we explain in how much water you need.

Should you cut out caffeine completely?

Not necessarily. Moderate coffee drinking is linked to lots of good things in large studies, including lower risk of type 2 diabetes and some liver diseases. For most people the problem isn't caffeine itself, it's when they have it.

If you do decide to cut back, taper over a week or two. Stopping suddenly can bring headaches, tiredness and irritability for a few days.

Frequently asked questions about caffeine and sleep

Does decaf coffee affect sleep?

Rarely, for most people. Decaf has a small amount of caffeine, but it's usually too little to matter unless you're very sensitive or drink a lot of it late at night.

Why does coffee make me sleepy?

Often it's the crash when caffeine wears off, or it's masking a big sleep debt. Sugar-loaded coffee drinks can add a blood sugar dip on top.

Is it bad to drink coffee as soon as you wake up?

There's a popular idea that you should wait 90 minutes. The evidence for that is thin. If morning coffee works for you and you sleep well, enjoy it.

Does tea keep you awake like coffee?

Tea usually has less caffeine per cup, but several cups late in the day can still affect sleep. Herbal teas like chamomile or peppermint are caffeine-free.

If your energy's been off, the free wellness wheel quiz can help you spot which part of your life is draining it.