Time caffeine intake around sleep.
Caffeine clears by first-order kinetics: whatever is in your bloodstream halves every half-life, typically around five hours in adults. That means an afternoon dose is only a quarter gone by dinner. Working backwards from the level you can sleep through gives a concrete cut-off time rather than a vague rule of thumb.
Exponential caffeine clearance
Remaining = dose x 0.5 ^ (hours / half-life); cut-off hours = half-life x log2(dose / tolerated level)
These figures are population-average estimates for general planning only and are not medical or dietetic advice. Individual energy and nutrient needs vary widely with body composition, activity, medication and health status. Consult a qualified health professional or registered dietitian before making significant changes to what you eat, and especially if you are pregnant or breastfeeding, are under 18, or have a medical condition or a history of disordered eating.
About five hours for a healthy adult. It stretches to eight or more hours during pregnancy or when taking oral contraceptives and some antibiotics, and shortens to roughly three hours in regular heavy smokers.
Around 50 mg is a common working figure — roughly half a cup of coffee. If caffeine barely affects your sleep, raise it; if a single espresso at lunch keeps you awake, drop it to 20-25 mg.
It models one dose. For several drinks, run it for each and add the bedtime remainders together, since clearance of each dose is independent.