On the call center shift I drank my last coffee at 11 p.m., on the break before the phones went quiet, and I was in bed by 3 a.m. I thought four hours was plenty. If you are asking how long before bed you should stop drinking coffee, the best-known study gives a short answer: at least six hours. My own arithmetic says it is often longer. The long answer is a half-life, some counting, and a number that is different for you than it is for me.

I fell asleep on those nights. That was the trap. I lay down, the light went off, and I was out. So I told myself the coffee was fine, and I kept waking at 6 a.m. feeling like I had been folded into a drawer. It took the spreadsheet and one study to show me that falling asleep and sleeping well are two separate columns.

What Drake found at six hours

The study everyone quotes on caffeine before bed is by Christopher Drake and colleagues, in the Journal of Clinical Sleep Medicine in 2013. It is small and it is careful, and both of those matter.

They took 12 healthy adults who normally slept well. Each person ran the test at home on four separate nights. On each of those nights they swallowed a pill at three set times: 6 hours before their usual bedtime, 3 hours before, and right at bedtime. On three of the nights, one of those pills held 400 mg of caffeine and the others were dummies. On the fourth night, all of them were dummies. Nobody knew which was which.

Sleep was measured two ways. A portable monitor recorded what the brain was doing overnight, and each person also filled in a sleep diary in the morning.

The caffeine hurt sleep at all three times, including the pill taken 6 hours before bed. On the monitor, the six-hour dose cut total sleep by more than an hour. The diaries are the part that stopped me. At six hours, people did not report a clear problem the way the monitor showed one. They lost the sleep and did not notice losing it.

That was me on the call center shift, almost exactly.

Some honest limits before anyone turns this into a rule:

  • 400 mg is a lot. It is roughly four ordinary brewed cups, or one or two very large coffee shop drinks.
  • Twelve people is a small group, and all of them were good sleepers to start with.
  • The study tested 0, 3 and 6 hours. It did not test 8 or 10, so it cannot tell you where the effect stops.

So for a big dose, six hours is the floor, not the finish line. The study shows that six hours was not enough. It does not show what is.

Caffeine half life, in plain arithmetic

Half-life means how long your body takes to clear half of the caffeine in you. After one half-life, half is left. After two, a quarter. After three, an eighth. On paper it never reaches zero. It just gets small.

Four mugs, each half as full as the one before, showing the caffeine half life behind how long before bed to stop drinking coffee.

The figure most sources use for adults is roughly five hours. Treat that as a middle, not a promise. Reviews of how people break caffeine down describe a wide spread between people, including Astrid Nehlig's review in Pharmacological Reviews in 2018. Some people clear half in a couple of hours, and others take eight or more.

Caffeine also takes a while to arrive. Most of it reaches your blood within about an hour of drinking, so the clock really starts a little after the mug is empty.

Here is one cup, worked through. Say it is a mug of about 200 mg, which a big 16 ounce mug of drip coffee can hold. You finish it at 3 p.m., and your half-life is five hours:

  • 8 p.m.: about 100 mg left
  • 1 a.m.: about 50 mg
  • 6 a.m.: about 25 mg

If your bedtime is 11 p.m., that is eight hours after the mug, or 1.6 half-lives. One half multiplied by itself 1.6 times comes to about a third. So you go to bed carrying roughly 66 mg, about what a single shot of espresso holds. You would never drink an espresso at 11 p.m. and call it nothing. On an average half-life, though, that is what a 3 p.m. mug looks like at bedtime.

The general rule is this: what is left equals the dose times one half, raised to the power of the hours passed divided by your half-life. You do not need to do that in your head at 3 p.m. That is what the caffeine cut-off calculator is for. You give it your bedtime and what you drink, and it counts back.

Why your number may not be my number

The same mug means different things in different bodies. Take the 3 p.m. mug and the 11 p.m. bedtime again:

  • If you clear caffeine fast, with a half-life of about three hours, you go to bed with roughly 30 mg.
  • On the five hour average, you go to bed with roughly 66 mg.
  • If you clear it slowly, with a half-life of about eight hours, you go to bed with about 100 mg, which is half the mug.

That spread is why I get twitchy when an article gives one cut-off time for everyone. Most of the clearing is done by one liver enzyme. How hard that enzyme works depends on your genes, and on things like smoking. You cannot see your half-life from the outside. The only honest approach is to assume a number, test it, and adjust.

If you take medication, are pregnant, or think you might have insomnia or another sleep problem, talk to a doctor about caffeine rather than using my arithmetic, because I am a person with a spreadsheet, as I explain on the about page.

There is also the question of how much caffeine is enough to matter, and the research does not draw a clean line. I have not found a study saying that under some number of milligrams at bedtime your sleep is untouched. So any threshold, including the one I use below, is a rule of thumb.

Tricks that do not move the number

I have tried most of these or believed them, and believing them was the same mistake made more slowly.

"Coffee does not affect me"

This was my line for years, and it is exactly what the Drake diaries caught. Falling asleep fast is not the same as sleeping deeply all night. The six-hour group lost over an hour of sleep without clearly noticing. If you feel fine when you lie down, that tells you about the first ten minutes, not the next seven hours.

"I drink so much that I am used to it"

People who drink coffee every day do get used to some of the buzzy, alert feeling. Whether that habit protects your sleep is a harder question. The studies I have read do not settle it, and I would not bet a night on it.

Water or a walk to flush it out

Your liver clears caffeine at its own pace. I have found no good evidence that drinking lots of water speeds that up in a way you would notice. You will just be up at 3 a.m. for a different reason.

Switching to decaf in the afternoon

This one mostly works, with a footnote. Decaf is not zero. A cup usually carries a few milligrams, sometimes more, depending on how it was made. Two decafs in the evening are not a problem for most people. Five might be.

Also count the caffeine that does not look like coffee. Black and green tea, cola, energy drinks, dark chocolate and some pre-workout powders all add to the same total.

How I set my own cut-off now

When I finally added a column for "last coffee" to the spreadsheet, I did not know my half-life, so I assumed a slow one. If I guess slow and I am wrong, I lose an afternoon mug. If I guess fast and I am wrong, I lose sleep, and I had spent years paying that bill.

My bedtime these days is 10:45 p.m. and my alarm is 6:30 a.m. I drink one big mug in the morning and, on a bad day, a small second one. Assuming an eight hour half-life, a second 100 mg cup at noon leaves me going to bed with roughly 40 mg, on top of what remains from the morning mug. The same cup at 3 p.m. would leave around 50. I picked noon and wrote it down.

Honestly, it did not change how fast I fell asleep, because I was already quick at that. What changed was the 3 a.m. column, the nights I woke and lay there. Over about six weeks those went from two or three a week to roughly one. That is one person with no control group, so take it as a story, not a finding. It was enough for me to keep the rule.

A few things have made the cut-off easier to keep:

  • I set a phone reminder at noon with no message, just the time.
  • When the afternoon slump comes, I try a walk or a glass of cold water first, and a decaf if that fails.
  • On the rare late night, I move the cut-off to match the bedtime, not the other way around. If you are pushing bedtime later, the sleep calculator will give you bedtimes that land at the end of a cycle.

If late coffee has been cutting your sleep short for a while, one good night will not make up for it. I explain why in what sleep debt is, and the sleep debt calculator adds up the missing hours.

What to try tonight

Take the time you plan to be asleep and count back. For a big dose, six hours is the least the Drake study supports. Eight to ten hours is safer if you drink a lot or suspect you clear caffeine slowly. Write down the time you land on.

Then open the caffeine cut-off calculator, enter tonight's bedtime and your usual cup, and see what it says. Keep that cut-off for two weeks and note how often you wake in the night. If that number does not drop, move the cut-off an hour earlier and try again.