Back to Blog
health||6 min read

Your Last Coffee Isn't the Problem; the First Three Are Still in Your System

AR
Aral Roca

Creator of Kitmul

A cup of coffee on a table, the start of a long caffeine day
A cup of coffee on a table, the start of a long caffeine day

A friend of mine was averaging 4 cups of coffee a day. Morning espresso at 7. Drip coffee at 10. Post-lunch lungo at 14:00. And an afternoon ristretto around 16:00 "just to push through." He wasn't sleeping well, but blamed stress, screens, the usual suspects.

I told him to do the math.

The exponential decay you're ignoring

Caffeine follows first-order elimination kinetics with a half-life of approximately 5 hours in healthy adults. The formula is simple:

remaining = dose * 0.5 ^ (elapsed_hours / 5)

A single 95mg drip coffee at 10:00 AM leaves ~47mg by 3 PM and ~24mg by 8 PM. Sounds harmless. But most of us don't drink a single cup.

When you stack multiple intakes, the decay curves overlap. That 63mg espresso at 7 AM is almost gone by evening, but the 80mg lungo at 2 PM still has 40mg in your system at 9 PM. Add the 40mg ristretto at 4 PM and you're sitting at 64mg of caffeine at bedtime; well above the 50mg sleep disruption threshold identified in clinical research.

The problem isn't any single cup. It's the superposition of all of them.

Different types of coffee beans and brewing methods, each with a different caffeine content
Different types of coffee beans and brewing methods, each with a different caffeine content

Why I built a multi-intake caffeine tracker

Most caffeine calculators I found online only handle one beverage. You enter "95mg at 8 AM" and get a decay curve. Useless if you're a multi-cup person; which is most of us, according to the FDA's average of 3-4 cups per day in the U.S.

So I built one that handles the actual workflow: add as many beverages as you want, each with its own type and time, and see the combined decay curve.

The Caffeine Half-Life Calculator supports 19 beverage presets, each backed by FDA, EFSA or Mayo Clinic reference values:

Beverage Caffeine (mg) Typical serving
Ristretto 40 1 short shot
Espresso 63 1 shot (30ml)
Lungo 80 1 long shot
Drip Coffee 95 240ml (8oz)
Cold Brew 200 1 serving
Americano 125 240ml, 2 shots
Latte 63 240ml, 1 shot
Cappuccino 63 180ml, 1 shot
Flat White 130 160ml, 2 shots
Mocha 95 350ml
Tonic Espresso 63 150ml, 1 shot
Instant Coffee 62 240ml (8oz)
Yerba Mate 85 240ml (8oz)
Matcha 70 2g powder
Energy Drink 80 250ml can
Black Tea 47 2g leaves
Green Tea 28 2g leaves
Cola 34 330ml can
Decaf 7 240ml (8oz)

Values reference: FDA, EFSA Scientific Opinion on Caffeine, Mayo Clinic caffeine chart. Milk-based espresso drinks inherit caffeine from the underlying shots; a "latte" is not a lower-caffeine drink, just a diluted one.

You can also enter custom amounts. Everything runs client-side in the browser; no data leaves your machine.

The math behind the combined curve

For N intakes, the total caffeine at time T is:

total(T) = sum(dose_i * 0.5 ^ ((T - t_i) / 5)) for all i where T >= t_i

Each intake only contributes to the total after its consumption time. The resulting curve isn't a simple exponential; it's a sum of shifted exponentials, which can produce surprising plateaus when intakes are spaced closely.

This is why eyeballing it doesn't work. A 3 PM coffee "doesn't seem like much," but combined with the residual caffeine from morning drinks, it can push your bedtime levels past the threshold.

A bed with white sheets, the place where caffeine levels finally matter
A bed with white sheets, the place where caffeine levels finally matter

What we learned about his consumption

After plugging in his actual daily routine:

  • 7:00 AM Espresso (63mg) ; mostly gone by evening; only 5mg left at 11 PM
  • 10:00 AM Drip Coffee (95mg) ; still 17mg at 11 PM
  • 2:00 PM Lungo (80mg) ; 28mg at 11 PM
  • 4:00 PM Ristretto (40mg) ; 18mg at 11 PM

Total at 11 PM: 68mg. That's 36% above the sleep threshold.

Dropping the 4 PM ristretto brought him to 50mg; right at the edge. Moving the lungo to 1 PM dropped it to 43mg. That single hour shift made the difference.

Developer workspace with a coffee cup next to a laptop
Developer workspace with a coffee cup next to a laptop

The developer who also drinks cold brew

If you're a developer reading this; and statistically you probably are, given where I'm posting this; cold brew is particularly dangerous. At 200mg per serving, a single cold brew at 2 PM leaves 71mg in your system at 11 PM. By itself.

Add that to a morning coffee and you're looking at 80+ mg at bedtime. No wonder you're staring at the ceiling at 1 AM wondering if it's the code review or the caffeine.

Technical details

The tool is built with React, runs entirely in the browser (no backend), and uses URL state for shareability. The decay chart uses a simple bar visualization with color coding:

  • Amber/dark: high caffeine (>50% of peak)
  • Amber/light: moderate (below 50% of peak, above sleep threshold)
  • Green: safe for sleep (below 50mg)

The source is part of Kitmul, a collection of 300+ free browser-based tools. If you're into health tracking, you might also find the BMI Calculator, BMR Calculator, or Water Intake Calculator useful; staying hydrated actually helps your body process caffeine more efficiently.

Practical takeaways

  1. Track all your intakes, not just the last one. Cumulative caffeine is what matters for sleep.
  2. The cutoff time depends on how many cups you've already had. A 2 PM coffee is fine after one morning cup, but not after three.
  3. Cold brew is not just "strong coffee." At 200mg it's in a different category entirely.
  4. Ristretto < Espresso < Lungo. Shorter extraction = less caffeine. If you want an afternoon coffee, go short.
  5. The 50mg threshold is a population average. If you're a slow metabolizer (CYP1A2 gene variant), your half-life could be 7+ hours. Adjust accordingly.

Try the Caffeine Half-Life Calculator with your actual daily intake. You might be surprised how much caffeine is still in your system at bedtime.


All calculations run locally in your browser. No data is sent anywhere. The tool is free, open, and has no accounts or limits.

Share this article

Newsletter

Get Free Productivity Tips & New Tools First

Join makers and developers who care about privacy. Every issue: new tool drops, productivity hacks, and insider updates — no spam, ever.

Priority access to new tools
Unsubscribe anytime, no questions asked