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 pick a caffeine cutoff that protects your sleep.

Updated October 22, 2026 · 8 min read

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

Last coffee at 4 p.m., felt totally fine at bedtime, and yet there you were at midnight, staring at the ceiling fan and wondering what on earth was going on. Sound familiar?

Caffeine hangs around a lot longer than most of us give it credit for. I think getting the timing right is one of the easiest, cheapest sleep fixes going, and you don't have to give up your morning cup to pull it off. Here are the numbers, what's lurking in your favorite drinks and how to find the cutoff that suits you.

How long caffeine stays in your system

Caffeine has a half-life of roughly five hours in a typical healthy adult, though it swings anywhere from about two to more than ten hours from one person to the next. The half-life is just the time it takes your body to clear half of it.

Say you knock back a coffee with 200 mg of caffeine at 4 p.m. By 9 p.m. there's still about 100 mg floating around, roughly a small cup of coffee's worth. At 2 a.m. it's about 50 mg, around what's in a mug of black tea, and when the alarm goes at 7 a.m. about 25 mg is still loitering.

So that 4 p.m. latte is a bit like sneaking a small coffee right before bed without meaning to. I find that picture sticks better than any rule.

Why caffeine hits some people harder

Ever wondered why your buddy can down an espresso after dinner and sleep like a log, while one afternoon tea keeps you up? A few things change how fast your body gets rid of caffeine:

  • your genes, since variations in a liver enzyme called CYP1A2 make some people fast metabolizers and others slow ones
  • pregnancy, which slows clearance way down, especially later on
  • hormonal birth control, with some oral contraceptives roughly doubling caffeine's half-life
  • certain antidepressants and antibiotics, which slow it down (your pharmacist can tell you if yours are on the list)
  • smoking, which speeds clearance up, so people who quit often find coffee suddenly packs more of a punch
  • liver disease, which slows clearance
  • age, as some people find they're touchier about caffeine than they used to be

How caffeine keeps you awake

All day long a chemical called adenosine slowly piles up in your brain, and the more of it there is, the drowsier you feel. That's part of what sleep scientists call sleep pressure.

Caffeine pulls a sneaky trick. It slots into the same receptors adenosine uses and jams them, so your brain never gets the "time for bed" memo. The adenosine is still there, waiting in the wings, and when the caffeine finally wears off it lands on you all at once – the famous caffeine crash.

The six-hour study

The Journal of Clinical Sleep Medicine published a small study in 2013 where 12 healthy sleepers took 400 mg of caffeine (about three or four cups of brewed coffee) either at bedtime, three hours before or six hours before. Even the dose taken six hours out cut their total sleep by more than an hour.

I can't stop thinking about the sleep diaries. At the six-hour mark the in-home sleep monitors picked up the lost sleep, but people's own diaries mostly didn't. They had no clue their sleep had been hit, which means caffeine can pinch your sleep without you ever noticing the theft. It was only 12 people, mind you, so I'd treat it as a strong hint more than the final word.

Caffeine also tends to nibble away at deep sleep, the most physically restorative stage. So even when you do drop off, the night can come out thinner 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 tied to dangerous effects in healthy adults. That's a safety ceiling and not a target, and it says nothing about timing. Two cups in the morning will probably land very differently on your sleep than two cups late in the afternoon.

Some groups need lower limits. During pregnancy, the American College of Obstetricians and Gynecologists advises staying under 200 mg a day. The American Academy of Pediatrics steers kids and teens away from energy drinks. And people with heart rhythm problems, anxiety or high blood pressure might need less, so it's worth a word with your doctor.

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

These are ballpark amounts, and brands are all over the place:

  • brewed coffee, 8 oz: about 80 to 100 mg
  • a 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 can
  • decaf coffee, 8 oz: usually 2 to 15 mg

Don't forget the sneaky sources, like dark chocolate, pre-workout powders, some "focus" gummies and certain pain relievers with caffeine baked in. That 3 p.m. candy bar adds up. I'd check the label on anything that promises focus, because that's usually code for caffeine.

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

What time should you stop drinking coffee?

My starting point would be no caffeine within 8 hours of bedtime. Some people get away with 6, but given what that study turned up at six hours, 8 gives you more breathing room.

The quick math works out like this:

  • 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 already wrestling with sleep, try a noon cutoff for two weeks and see what shifts. I suspect plenty of people would be floored by the difference.

The tired-wired loop

Bad sleep leaves you tired, tired sends you reaching for more coffee, and more coffee late in the day wrecks your sleep. Round and round it goes like a hamster wheel.

Breaking the loop usually costs you a few rough afternoons. When the 3 p.m. slump hits, try one of these in place of a refill:

  • a brisk 5 to 10 minute walk, ideally outside in daylight
  • a big glass of cold water, since mild dehydration can masquerade as tiredness
  • a 10 to 20 minute power nap, if you can swing it
  • a snack with some protein, like yogurt or a handful of nuts
  • decaf or herbal tea, so you keep the ritual

I won't pretend the first few afternoons are a picnic. Grit your teeth for a week or so and your nights tend to perk up. If you want the full picture, here's how much sleep adults really need.

Caffeine and anxiety

At higher doses caffeine can bring on a pounding heart, the jitters, sweaty palms and a sense of dread that feels a whole lot like anxiety. For people who already live with anxiety or panic attacks, it can crank the symptoms up. Some people feel it after one strong coffee and others only after three or four.

I'd try halving your caffeine for two weeks if you often feel wound up in the afternoon, then watch whether your mood settles. There are more natural ways to ease anxiety worth a look, and since bedtime anxiety is its own sleep thief, cutting caffeine can pay off twice.

Does coffee dehydrate you?

Not really, if you drink it regularly. Caffeine has a mild diuretic effect, but the water in a cup of coffee or tea more than makes up for it, and studies of everyday coffee drinkers found moderate amounts hydrate about as well as water. So yes, your coffee counts toward how much water you need each day.

Should you cut out caffeine completely?

Not necessarily. Big studies have tied moderate coffee drinking to good things, including less type 2 diabetes and fewer cases of some liver diseases, though those studies can't prove the coffee did it. Where we mostly come unstuck is the timing.

If you do decide to cut back, taper off over a week or two. Going cold turkey can bring on headaches, tiredness and a short fuse for a few days.

Frequently asked questions about caffeine and sleep

Does decaf coffee affect sleep?

Rarely, for most people. Decaf has a smidge 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 the caffeine was papering over a big sleep debt. Sugar-loaded coffee drinks can throw 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, but the research behind it 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 mess with sleep. Herbal teas like chamomile or peppermint are caffeine-free.

If your energy has been off lately, the free wellness wheel quiz shows which part of your life is draining it.

Sources

  1. Journal of Clinical Sleep Medicine via PMC (Drake et al.). Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed (2013).
  2. American Academy of Sleep Medicine. Late afternoon and early evening caffeine can disrupt sleep at night (2013).

We check facts against these sources when we write or update a guide (see our editorial policy). Spotted something out of date? Email info@8dofwellness.com.