Caffeine Calculator
Total today's caffeine, check it against the 400 mg limit, and see what is still in your system when you go to bed.
What you drank today
Enter how many of each. Leave anything you skipped at zero.
Leave at 5 unless you know yours. Smokers clear it faster (about 3 h); pregnancy, the pill and some medicines slow it to 7–10 h.
Breakdown
Estimates based on typical serving averages, not medical advice. Caffeine sensitivity varies widely between people.
What a normal caffeine day actually adds up to
Most people underestimate their intake because they count cups, not milligrams. An 8 oz mug of drip coffee averages about 95 mg, but almost nobody drinks 8 oz. A 16 oz Starbucks grande brewed coffee runs closer to 310 mg on its own, a 12 oz cold brew sits near 155 mg, and a 16 oz energy drink is typically 160 mg. Tea is gentler but not trivial: a strong mug of English breakfast lands around 47 mg, green tea about 28 mg. Dark chocolate, cola and some painkillers quietly add another 30 to 100 mg on a bad day.
The reference point everyone quotes is 400 mg a day for healthy adults, the figure the US FDA and the European Food Safety Authority both settled on. In pregnancy the guidance drops to 200 mg, which is one large coffee shop americano and nothing else. Those are population thresholds, so treat them as a lane marking rather than a cliff edge.
Worked example: the ordinary two-coffee day
Say you have a drip coffee at 7:30 am, another at 10:00 am, an espresso after lunch at 2:00 pm, and a Diet Coke at 4:00 pm. That is 95 + 95 + 63 + 34 = 287 mg, or 72% of the 400 mg limit. Nothing alarming — until you look at when the last dose lands. With the Diet Coke at 4:00 pm and lights out at 11:00 pm, seven hours pass. Using a five-hour half-life, the fraction remaining is 0.5^(7/5) = 0.379, so roughly 109 mg of that day's caffeine is still circulating as you try to fall asleep. That is about the dose that has been shown to measurably reduce deep sleep in controlled trials.
Swap the 4:00 pm cola for sparkling water and the last caffeine becomes the 2:00 pm espresso. Now nine hours pass: 0.5^(9/5) = 0.287, and the residue drops to about 82 mg. Move the espresso to noon and eleven hours give 0.5^(11/5) = 0.217, leaving roughly 62 mg. Same drinks, same total, meaningfully different nights.
How the decay curve behaves
Caffeine follows first-order kinetics at ordinary doses, which is a formal way of saying a fixed fraction leaves per hour rather than a fixed amount. After one half-life you have 50% left, after two 25%, after three 12.5%. Peak blood levels arrive 30 to 60 minutes after you drink it, so the curve rises fast and then tails off slowly. The tail is the part that ruins sleep: 300 mg at 3:00 pm still leaves about 75 mg at 11:00 pm, which is why "it doesn't keep me awake" and "I sleep badly" are not contradictory statements.
Five hours is the textbook half-life, but the honest range is 3 to 7 hours. Smokers clear caffeine roughly twice as fast. Oral contraceptives can double the half-life. In the third trimester of pregnancy it can exceed 10 hours, which is part of why the guidance is halved. Some antibiotics, antifungals and liver conditions slow it further. This calculator uses five hours, so read the bedtime number as a middle estimate, not a measurement.
Deriving your own cutoff time
Pick a target residue — 50 mg is a reasonable ceiling for most sleepers, 25 mg if you are sensitive. Then solve for hours: hours = 5 x log2(total / target). For a 300 mg day and a 50 mg target that is 5 x log2(6) = 5 x 2.58 = about 13 hours, meaning an 11:00 pm bedtime wants your last caffeine before 10:00 am. For a 200 mg day and the same target it is 5 x 2 = 10 hours. The widely repeated "no caffeine after 2:00 pm" rule is really this calculation done once for a moderate intake and an eleven o'clock bedtime.
Tolerance and dependence, without the sugar-coating
Regular use builds tolerance to the alertness effect within days, mostly through adenosine receptor upregulation. Tolerance to sleep disruption is far less complete: habitual drinkers still show fragmented sleep architecture on evening doses. That combination is the trap — the boost fades while the cost stays. Withdrawal is a recognised clinical syndrome: headache, fatigue, irritability and difficulty concentrating starting 12 to 24 hours after your last dose, peaking around day one or two and usually resolving within nine days. Cutting by about 25% every three days avoids most of it.
What this tool cannot tell you
Serving values are averages. Real coffee varies with bean, grind, brew time and cup size, and two identically labelled energy drinks can differ by 40 mg. The bedtime figure assumes the whole day's caffeine was taken at the time of your last drink, which makes it a deliberate upper bound rather than a precise blood level. It cannot model your CYP1A2 genotype, medication, pregnancy or heart condition. If you get palpitations, anxiety or persistent insomnia, that is a conversation with a clinician, not a calculator.
Sources & further reading
Frequently asked questions
Where does the 400 mg daily limit come from?
The US FDA and EFSA both reviewed the evidence and landed on about 400 mg a day for healthy adults — roughly four 8 oz cups of drip coffee — as an amount not generally linked to negative effects. It is a population average, not a personal safety line. People who carry the slow variant of the CYP1A2 gene clear caffeine far more slowly and can feel jittery or sleepless at half that dose.
How long does caffeine stay in your body?
The half-life is usually quoted as 5 hours, but the real range is about 3 to 7 hours in healthy adults. Smoking roughly halves it, pregnancy can stretch it past 10 hours, and oral contraceptives, some antibiotics and liver conditions all slow it down. After one half-life, half the dose is still circulating; after two, a quarter.
How much caffeine at bedtime actually hurts sleep?
Controlled studies have found measurable losses of deep sleep from doses as small as around 100 mg taken in the evening, and one trial saw 400 mg taken six hours before bed cut total sleep by more than an hour. Many people sleep through it and still wake up unrefreshed. A practical rule is to keep your last caffeine at least eight hours before bed, or aim for under 50 mg still active at bedtime.
What happens if I cut back suddenly?
Withdrawal is real and well documented: headache, fatigue, low mood and poor concentration, typically starting 12 to 24 hours after your last dose and peaking on day one or two. It usually clears within two to nine days. Tapering by about 25% every few days avoids most of it, and swapping one coffee at a time for a half-caf or tea works better than quitting cold.