Caffeine Calculator
Add the coffees, teas and energy drinks you had today and see exactly how much caffeine is still in your system at bedtime — plus the latest time you can have a cup without wrecking your sleep. No sign-up, completely free.
What did you drink today?
95 mg of caffeine at 8:00 AM
126 mg of caffeine at 2:00 PM
The vertical line marks your bedtime; the dashed line is the ~50 mg level below which caffeine rarely disturbs sleep.
How caffeine’s half-life works
Caffeine doesn’t just “wear off” — it clears your body through exponential decay. The key number is its half-life: the time it takes for half the caffeine to be removed, which is about 5 hours for a typical adult. So if you drink a 95 mg coffee at 3pm, you still have roughly 48 mg at 8pm, 24 mg at 1am, and so on. Because the decline is gradual, an afternoon coffee can leave a meaningful dose circulating right when you’re trying to sleep.
The calculator applies the formula remaining = mg × 0.5^(hours ÷ half-life) to every drink you add, then sums them. If you metabolize caffeine faster or slower than average, open the Advanced toggle and slide the half-life between 4 and 6 hours to match your body.
When to stop drinking coffee before bed
Caffeine works by blocking adenosine, the molecule that builds your drive to sleep. Even if you can fall asleep with caffeine onboard, it tends to make your sleep lighter and cut into restorative deep sleep. As a guide, aim to finish your last caffeinated drink 6–8 hours before bed.
For a standard ~95 mg coffee, it takes about 4.6 hours to fall below the ~50 mg level where caffeine rarely disturbs sleep — but larger drinks (cold brew, energy drinks, a double latte) need longer. The calculator turns this into a single, personal last-cup cutoff based on your own bedtime, so you don’t have to do the maths.
Caffeine in common drinks
Caffeine content varies a lot by drink and serving size. As a rough guide: brewed coffee ~95 mg per 8 oz, a single espresso ~63 mg, a latte or cappuccino ~63–126 mg depending on shots, cold brew ~155 mg per 12 oz, black tea ~47 mg, green tea ~28 mg, matcha ~70 mg, a typical energy drink ~80 mg, and a can of cola ~34 mg. Those are the presets in the calculator above — pick whatever’s closest and adjust the time you drank it.
Caffeine calculator FAQ
How does the caffeine calculator work?
Caffeine leaves your body through exponential (first-order) decay, with a half-life of about 5 hours in a typical adult. The calculator takes each drink you add, works out how many hours pass before your bedtime, and applies the formula remaining = mg × 0.5^(hours ÷ half-life). It then adds up every drink to show the total caffeine still circulating when you try to sleep.
What is the half-life of caffeine?
For most healthy adults the half-life is around 5 hours, meaning half the caffeine is gone after 5 hours, three-quarters after 10, and so on. It’s shorter (~4 hours) for smokers and fast metabolizers, and longer (6+ hours) during pregnancy, on oral contraceptives, or with certain medications. Use the Advanced toggle to match your own.
When should I stop drinking coffee before bed?
A useful rule of thumb is to have your last caffeinated drink at least 6–8 hours before bed. Because a standard coffee has ~95 mg and the half-life is ~5 hours, it takes roughly 4.6 hours for that cup to fall under the ~50 mg level where caffeine rarely disturbs sleep. The calculator computes your exact last-cup cutoff from your bedtime.
How long does caffeine last in your system?
You’ll feel the peak effect within 30–60 minutes, but caffeine lingers far longer. With a 5-hour half-life, a 200 mg dose still leaves about 50 mg after 10 hours and 25 mg after 15. That’s why an afternoon coffee can quietly shorten your deep sleep even if you fall asleep fine.
Why can I fall asleep after coffee but still wake up tired?
Falling asleep and sleeping well are different things. Caffeine blocks adenosine, the chemical that builds sleep pressure, so even when you nod off, your deep and REM sleep can be lighter and more fragmented. You sleep, but you don’t fully recover — which is why the morning still feels rough.
This tool is for general wellbeing and education only. It uses population-average estimates for caffeine content and metabolism, so your real numbers will vary. It is not medical advice. If you have ongoing insomnia, heart palpitations, anxiety, or are pregnant, please speak with a qualified healthcare professional.