Caffeine cut-off calculator

Count back from bedtime with the caffeine half-life to find the time of your last coffee.

Your cut-off for bedtime at 11:00 PM

6:22 PM

4 h 38 min for 95 mg to fall to 50 mg.

Rule of thumb from Drake et al. 2013 in the Journal of Clinical Sleep Medicine: nothing after 5:00 PM.

Caffeine falling from 95 mg to 50 mg between 6:22 PM and 11:00 PM0509550 mg linecut-off5:00 PM11:00 PM6 h before

Five hours is the usual figure. Pregnancy and oral contraceptives push it up, smoking pulls it down, and some medications change it either way, so move this if you know yours.

The call center closed at 2 a.m. and the coffee machine did not, so for two years my last cup was around midnight and my first alarm went unheard at 9. When I built the spreadsheet I gave the last coffee its own column and moved it earlier a week at a time until the mornings changed. This page is that column with the arithmetic shown.

Give it what you drank, how many, and when you want to be asleep. It counts back with the caffeine half-life to the time of your last cup, draws the curve, and marks the six hour rule next to it so you can see how the two compare.

How the math works

Half-life is the time your body takes to clear half of what you took. For caffeine the usual figure is five hours, so the 95 mg in a drip coffee is about 48 mg five hours later and about 24 mg five hours after that. It never quite reaches zero. It keeps halving.

That is why the calculator asks for a line rather than waiting for zero. The formula is one sentence: hours to clear equals the half-life times the log base 2 of the dose divided by the amount you are willing to have left. Log base 2 just counts how many halvings it takes.

Worked through with the defaults: 95 mg, a five hour half-life, and a 50 mg line. That is a little under one halving, 4 h 38 min, so an 11 p.m. bedtime puts the last coffee at 6:22 p.m. Two coffees is 190 mg, one more halving, 9 h 38 min, and the cut-off moves to 1:22 p.m. Every doubling of the dose costs one extra half-life. That is the part I wish someone had told me at the switchboard.

The 50 mg line is my rule of thumb, not a study number. It is about half a cup still in you when the light goes off, and it is where I stopped noticing the coffee. The slider runs from 10 to 100 mg because some people feel a single cup at lunch and some sleep fine after an espresso with dessert.

The milligrams per drink are averages. A drip coffee varies with the beans, the pour and the size of the cup, and a cafe pour can hold a good deal more than the list says. If you know the number on the label, pick the custom option and type it in.

What the curve shows

The curved line is the caffeine left in you, falling from the moment of the last cup to bedtime. The flat dashed line is the amount you said you could live with at lights out. Where the two meet is bedtime.

The dot at the top of the curve is the cut-off, the moment of the last cup, with a vertical line down to the axis. The small tick under the axis marks six hours before bed so you can see how the arithmetic compares with the rule of thumb. When the dose is already under your line, the dot sits at bedtime and the curve has nowhere to fall.

The six hour rule

The rule you have probably heard is no caffeine in the six hours before bed. It comes from one small study, and the study is worth knowing. Drake, Roehrs, Shambroom and Roth, in the Journal of Clinical Sleep Medicine in 2013, gave twelve people 400 mg of caffeine at bedtime, three hours before bed, or six hours before bed, on different nights, and measured their sleep. The dose six hours out still cut measured sleep by about an hour, and the participants mostly did not notice it had.

Two things follow from that. The dose was 400 mg, about four drip coffees, so six hours is a floor for a big dose, not a ceiling for a small one. Run 400 mg through the calculator with the defaults and it wants 15 hours, which is why the six hour mark is drawn on the chart next to the arithmetic instead of replacing it. The part about not noticing is the one I believe most. The next section is why.

Where the arithmetic is honest and where it is not

The half-life is the honest part and the shaky part at once. The Institute of Medicine's 2001 review gives about five hours as typical and 1.5 to 9.5 hours as the range between people. Pregnancy and oral contraceptives lengthen it a lot, smoking shortens it, and some medications change it in either direction. The slider runs from 3 to 7 hours, which covers most people and still misses some. If you are pregnant or on the pill, drag it up.

I found this out the slow way. On the switchboard I could drink a coffee at 10 p.m. and be asleep by midnight, and I took that as proof that I cleared caffeine fast. What it proved was that I was twenty-four and so short on sleep that nothing could have kept me up. The sleep was worse than it felt. Six weeks with the cut-off moved to 4 p.m. and the 5:40 wake-ups from Waffles started to feel like mornings instead of ambushes.

Sensitivity is the other thing the formula cannot see. Two people with the same half-life can react very differently to the same 50 mg, which is what the line slider is for. Move it until the number on the page matches what your nights tell you.

I am not a doctor. Caffeine alongside a medication, a heart condition, or a pregnancy is a question for one, and a calculator is the wrong place to settle it.

Tonight

Set the bedtime you actually want, not the one you usually get, and read the cut-off. If it is earlier than your last cup was today, move tomorrow's last cup by an hour and see what the morning does. The sleep calculator gives you the bedtime to count back from if you only know your alarm, and what time should I go to bed has the studies behind that number.

Questions I get about this

How long does caffeine stay in your system?
Longer than the buzz. The Institute of Medicine's 2001 review gives about five hours as the typical half-life, with a range of 1.5 to 9.5 hours between people. With a five hour half-life, a 95 mg drip coffee is down to about 48 mg after five hours and about 24 mg after ten. It does not hit zero; it keeps halving. The calculator asks how much you are willing to have left at bedtime and counts back from there.
When should I stop drinking coffee before bed?
With the defaults, one drip coffee needs 4 h 38 min to fall from 95 mg to 50 mg, so for an 11 p.m. bedtime the last cup is 6:22 p.m. Two coffees add one more half-life and push that to 9 h 38 min, or 1:22 p.m. If you drink a lot, the six hour rule from Drake and colleagues is a floor, not a target: 400 mg six hours before bed still cost their participants about an hour of measured sleep.
Why is the line set at 50 mg?
Because it is about half a cup of drip coffee still in you when the light goes off, and that is where I stopped noticing it. It is a rule of thumb, not a study number. Nobody has measured a universal safe amount and I would not trust one if they had, because sensitivity varies as much as half-life does. The slider goes from 10 to 100 mg. If you know a single cup at lunch wrecks you, drag it down.
Does decaf count?
Barely. A cup of decaf has about 2 mg, which is under any line the calculator lets you set, so it shows bedtime itself as the cut-off. Cafe decaf varies more than that and a few cups can add up to a green tea, but for one cup the arithmetic says do not worry about it.
What about tea, cola or energy drinks?
Same arithmetic, smaller doses. The list uses averages: black tea 47 mg, green tea 28, cola 34, a 250 ml energy drink 80. A large energy drink can be two or three of those cans, so pick the custom option and type the number on the label if it has one. Tea steeped for six minutes is not the same as tea steeped for two, and the calculator cannot see your teapot.

Everything on Caffeine

What to sleep on

Guides to pillows, built from the manufacturers' own specifications and the arithmetic this site runs on. Nobody here has slept on these.

Other tools