Free web tool · no sign-up

Caffeine calculator: what’s still in your system at bedtime.

Add today’s coffees, teas and energy drinks with the time you drank them. The calculator decays each dose against your bedtime and shows the milligrams that will still be arguing with your sleep.

13 mg at bed

Assumes an average half-life you picked above; the real range runs about 2–12 hours depending on genetics, contraceptives and smoking. The Hespera app decays each drink against your bedtime automatically and suggests a personal cutoff.

The pharmacology, briefly

How the caffeine math works.

  1. 01

    Every drink starts a countdown

    Caffeine leaves your body exponentially: after one half-life, half the dose remains; after two, a quarter. The typical half-life is about five hours — a 3 PM coffee is still half with you at 8 PM.

  2. 02

    Doses stack

    The morning espresso, the lunch cola and the 4 PM tea don’t take turns — their remainders add up. The curve in this calculator is that running total, drink by drink.

  3. 03

    Half-life is personal

    The real range runs roughly 2 to 12 hours. Genetics (CYP1A2), oral contraceptives and pregnancy slow clearance; smoking speeds it up dramatically. Pick the profile that matches how coffee usually treats you.

  4. 04

    Bedtime is the deadline

    What matters for sleep isn’t how much you drank — it’s how many milligrams are still active at lights-out. Under about 50 mg, most people are fine. Above 100, expect a fight.

Quick reference

Caffeine in common drinks.

Typical values — brands and brew strength vary a lot, cold brew especially.

DrinkCaffeine
Espresso, single shot63 mg
Drip coffee, 8 oz95 mg
Coffee, 16 oz (grande-ish)~190 mg
Cold brew, 16 oz~200 mg
Black tea, cup47 mg
Green tea, cup28 mg
Energy drink, 8.4 oz80 mg
Energy drink, 16 oz~160 mg
Cola, 12 oz can34 mg
Pre-workout, scoop150–300 mg
Decaf coffee, cup2–7 mg

Caffeine sets when you can fall asleep; the sleep calculator sets when you should. The caffeine & sleep guide has the research behind both.

From one day to a pattern

One evening is a guess. Three weeks is evidence.

The app logs drinks in seconds, runs this decay curve against your real bedtime every night, and only calls caffeine out once the pattern repeats — then suggests a cutoff time built for your schedule instead of a generic “no coffee after 2 PM”.

Download on theApp Store
caffeine curvepersonal cutoffdeep sleep impactnight quality scorefactor evidencetonight’s plan

FAQ

Caffeine questions, answered.

How long does caffeine stay in your system?

With a typical 5-hour half-life, a 200 mg cold brew leaves about 100 mg after 5 hours, 50 mg after 10, and 25 mg after 15. Practically, a big afternoon dose is still doing meaningful work at midnight — the calculator shows the exact curve for your drinks.

When should I stop drinking coffee before bed?

Experimental work found that 400 mg of caffeine taken even 6 hours before bed measurably cut sleep time, so for a standard coffee 8–9 hours is a safer buffer, and for large doses longer still. Your personal cutoff depends on dose and metabolism — which is exactly what this calculator estimates.

Why can some people drink espresso after dinner and sleep fine?

Mostly genetics: fast CYP1A2 metabolizers clear caffeine in a couple of hours, and some people’s adenosine receptors are less caffeine-sensitive. Also, "sleeping fine" often isn’t — in studies, people underestimated how much late caffeine fragmented their sleep because they still fell asleep eventually.

Does caffeine reduce deep sleep even if I fall asleep?

Yes — that’s its quietest cost. Caffeine at night delays sleep onset, but it also suppresses slow-wave (deep) sleep and makes the night lighter and more fragmented, even when total sleep time looks nearly normal. You pay in quality before you pay in minutes.

Does decaf have caffeine?

A little — typically 2 to 7 mg per cup versus about 95 mg for regular drip. For almost everyone that’s negligible at bedtime, though a very sensitive sleeper drinking multiple evening decafs might still notice.

What does the Hespera app do beyond this calculator?

It tracks your drinks daily with the rest of your day — naps, stress, screens, exercise — decays each dose against your actual bedtime, and then shows the pattern: whether late caffeine is genuinely one of the things repeatedly hurting your nights, and what cutoff time fits your schedule.