Caffeine calculator
The question with caffeine is not how much but when. Because your body clears only half of a dose in about five hours, two espressos in the afternoon are still a half-cup dose near midnight, and none of that shows up in the daily total. Enter what you drank today and when you go to bed below, and we will work out what's left — and the latest hour for your next coffee.
Still in your body at bedtime
0.7 cups of filter coffee · half-life 5 hours
- Total taken today268 mg
- Largest single dose126 mg
- 4 hours after going to bed37 mg
- 8 hours after going to bed21 mg
Caffeine is not a number on its own: the same coffee makes for a different day on an empty stomach than after a meal. Log your coffee alongside your meals in FitDex and you see the two side by side.
Caffeine per serving
The values below are per serving, and the coffee, tea and cola rows come from the widely quoted USDA per-serving figures. The most variable entry in the list is Turkish coffee: grind, water ratio and time in the pot change the result noticeably, so a mid value is used here.
| Drink | Caffeine | Left at bedtime |
|---|---|---|
| Filter coffee (240 ml) | 95 mg | 63 mg |
| Espresso (30 ml) | 63 mg | 42 mg |
| Turkish coffee (60 ml) | 65 mg | 43 mg |
| Instant coffee (240 ml) | 62 mg | 41 mg |
| Decaf coffee (240 ml) | 2 mg | 1 mg |
| Black tea (240 ml) | 47 mg | 31 mg |
| Green tea (240 ml) | 28 mg | 18 mg |
| Cola (330 ml) | 32 mg | 21 mg |
| Energy drink (250 ml) | 80 mg | 53 mg |
| Dark chocolate (30 g) | 24 mg | 16 mg |
The third column shows a single scenario: the drink was taken three hours before bed and the half-life is five hours. Enter your own hours in the form above and the number changes accordingly. Limits: daily 400 mg · in one sitting 200 mg · in pregnancy, daily 200 mg · our own sleep threshold 50 mg.
How is it calculated?
The whole calculation is one equation: remaining = taken × 0.5^(hours elapsed ÷ half-life). The half-life is how long your body needs to clear half a dose. In the sample day, two espressos at 13:00 are 126 mg; with bedtime at 23:00 that's 10 hours, or two half-lives, leaving 31.5 mg.
The half-life is offered as a choice rather than a single number: 3, 5 or 7 hours. That is the range reported in healthy adults, and the difference is personal — smoking shortens it, pregnancy and oral contraceptives lengthen it considerably. Presenting the average as the one truth would mislead a slow metaboliser in exactly the wrong direction.
Exponential decay has one useful property: it is memoryless. Because knowing the amount at bedtime is enough to compute the middle of the night and the morning, with no need to add the drinks up again, the "4 hours after bed" and "8 hours after bed" rows fall out of a single multiplication. The past stops mattering.
Caffeine per serving comes from a fixed table: filter coffee 95 mg, espresso 63 mg, black tea 47 mg, energy drink 80 mg. Turkish coffee is the most variable entry — grind, water ratio and time in the pot change the result noticeably; a mid value is used here.
Two safety limits come from EFSA: for healthy adults, intakes up to 400 mg a day and up to 200 mg in one sitting are considered safe; in pregnancy the daily limit is 200 mg. These are safety numbers, not sleep numbers — a day well under 400 mg can still ruin a night.
The "last coffee" hour answers a different question: how late can a cup of filter coffee be drunk and still be under 50 mg by bedtime. Falling from 95 mg to 50 mg takes 4 hours 38 minutes on a five-hour half-life, so for someone going to bed at 23:00 the answer is 18:22. That hour is independent of what you drank today, because so is the question: "if I had one more coffee, how late could it be?"
How to read your result
The sample day shows why the table isn't enough. The total is 268 mg. That sits comfortably under the 400 mg daily limit and raises no warning, yet 64 mg — roughly two-thirds of a cup — is still present at bedtime. Someone looking only at the daily total would call that day fine; but the number that governs caffeine's effect on sleep is not the total, it's those 64 mg.
The morning coffee's share of the evening is smaller than people assume, and the afternoon one's is larger. In the sample only 12 mg is left at bedtime from the 08:00 filter coffee, while 31.5 mg comes from the two 13:00 espressos and 20 mg from a single 17:00 tea, which puts more than half of the evening load on the afternoon drinks. Moving coffee EARLIER is, for most people, easier and more effective than drinking less of it.
Watch what happens when you change the half-life. The same day ends with far more caffeine at bedtime on a slow metabolism (7 hours) and far less on a fast one (3 hours). "Coffee has no effect on me" and "one cup and I'm up all night" can both be true; that number is much of the difference.
The midnight and morning rows show something else: caffeine does not merely delay falling asleep, it is still there in the middle of the night. In the sample there are 37 mg at 03:00. A third of a cup. At three in the morning. For someone who falls asleep fine yet wakes unrested, the explanation may be sitting in that row.
The 50 mg threshold is our comfort line, not a regulatory limit. It is roughly half a cup of filter coffee, and its purpose is to give a comparable reference, not to forbid anything. Your own threshold may be lower; if you are sensitive to caffeine, moving the "last hour" on this page an hour or two earlier is reasonable.
Sleep isn't caffeine's only effect, but it is the most measurable one. Tolerance develops: in regular drinkers the alertness effect fades while the effect on sleep does not fade to the same degree, so the evening coffee drunk under the feeling that "it doesn't affect me any more" can still shorten the night. Losing the feeling is not losing the effect.
Frequently asked questions
What time should I stop drinking coffee?
There is no single hour for everyone; the answer depends on your bedtime and your metabolism. On the average half-life (5 hours), a cup of filter coffee takes 4 hours 38 minutes to fall below 50 mg — so for a 23:00 bedtime the last hour is 18:22. Choose the 7-hour half-life and the same calculation exceeds six and a half hours, pushing the last hour into the afternoon. The box above shows this hour for your own figures.
How do I know which half-life applies to me?
Precisely, only a blood measurement tells you — but there are practical signs. Smoking speeds caffeine clearance; pregnancy and oestrogen-containing contraceptives slow it markedly; liver disease slows it too. If none of these apply, start with the average of 5 hours. A better method is a trial: for a week, take your last coffee at the hour this page gives you; if your time to fall asleep doesn't change, you may be on the slow side — set the half-life to 7 hours and read the hour again.
I stay under 400 mg a day — that's fine, isn't it?
For safety, yes; for sleep, not necessarily. EFSA's 400 mg is the daily intake at which no adverse effect is expected in healthy adults; it says nothing about sleep. The sample day on this page shows exactly that: 268 mg in total, comfortably under the limit, and still 64 mg present at bedtime. The two numbers answer two different questions — the total concerns safety, the remainder concerns sleep.
Is decaf really caffeine-free?
No — "decaffeinated" does not mean zero. A cup typically retains around 2 mg, about a fortieth of regular coffee. For sleep that amount is practically irrelevant: it is already below the 50 mg threshold with no waiting at all. But for someone drinking several cups through the evening the total still isn't zero, and if you add them to the list the tool counts them.
Related tools
- Water intake calculatorWork out your daily water need from your weight. We also trace where the "eight glasses a day" rule came from and why it's been misread — the real indicator isn't a glass count, it's the colour of your urine.
- Calorie calculatorEnter your height, weight, age and activity level to see your daily calorie needs, basal metabolic rate and macro split in seconds. The same formula as the FitDex app.
- Nutrition label analyzerEnter the table from the back of the pack and get which claims the product may legally carry, the traffic-light colour of four nutrients, and whether the label is internally consistent. In the sample product three lights are red, yet it qualifies for exactly one claim: low salt.
- Food swap calculatorWhat do you gain by replacing something you eat with a lighter alternative at the same weight? 80 foods, computed at your own portion. The difference: it marks the swaps that cut calories without cutting protein and fibre.
This tool is for information only and is not a substitute for medical diagnosis or treatment. Talk to a healthcare professional before making a lasting change to how you eat.