halflife.coffee

caffeine half-life tracker
0mg
estimated caffeine in your system
You can sleep at about
You're clear to sleep now
Add a drink
🕓 When:
Your profile
lbs
Your habitual intake affects caffeine tolerance. Higher daily consumption raises your effective sleep threshold because your brain has adapted to baseline caffeine levels.
mg
The caffeine level below which you can fall asleep. Calculated from your weight × tolerance. Adjust based on your experience.
Metabolism & half-life
5.7h
How fast your body breaks down caffeine. Average is 5.7 hours — meaning after 5.7h, half the caffeine is gone.
This is mostly genetic. The CYP1A2 gene controls the liver enzyme that metabolizes caffeine. About 50% of people carry the AA genotype (fast metabolizer, half-life 2–4h). ~40% are AC (intermediate, 4–6h) and ~10% are CC (slow, 6–9h). If you've done 23andMe or similar, look for rs762551 in your CYP1A2 results.
A second gene, ADORA2A, controls how strongly you feel caffeine while it's active. The TT genotype at rs5751876 is linked to greater sleep disruption regardless of how fast you clear caffeine.
Factors that slow metabolism (raise the slider): oral contraceptives, pregnancy, grapefruit juice, fluvoxamine (SSRI). Factors that speed it up (lower the slider): smoking/nicotine, heavy exercise, cruciferous vegetables (broccoli, cauliflower).
This slider doesn't change your sleep threshold — it changes how long it takes to reach it. Watch the chart curve shift as you adjust.
Show your work
Caffeine level at time t
For each drink, caffeine absorbs linearly over ~45 minutes, then decays exponentially:
if t < 45min: C(t) = dose × (t / 45)
if t ≥ 45min: C(t) = dose × 0.5^((t - 45) / half-life)
Total caffeine = sum of C(t) for all drinks. The chart plots this continuously for 24 hours centered on now.
Sleep threshold
Base threshold = body weight in kg × 0.6 mg/kg. This is a rough estimate of the caffeine level below which a caffeine-naive person can fall asleep, based on adenosine receptor binding studies. It’s then scaled by a tolerance multiplier based on habitual daily intake:
Light (<200 mg/day): ×1.0
Moderate (200–400): ×1.6
Heavy (400–600): ×2.2
Very heavy (600+): ×3.0
The multipliers reflect adenosine receptor upregulation from chronic caffeine exposure. Regular users develop pharmacodynamic tolerance — the brain adapts to baseline caffeine, so higher residual levels are needed before caffeine meaningfully blocks sleep. These are rough estimates; no published formula exists for this. Adjust threshold based on your actual experience.
Half-life
Default 5.7h is the population average. Actual range is 2–9h depending primarily on CYP1A2 genotype (rs762551): AA = fast (2–4h), AC = intermediate (4–6h), CC = slow (6–9h). Smoking, exercise, and oral contraceptives further modify this. Half-life affects when you cross the threshold, not the threshold itself.
Limitations
This model uses first-order kinetics with a simplified linear absorption phase. Real pharmacokinetics are messier — food slows absorption, liver saturation at very high doses changes the curve, and individual variation is substantial. Treat all times as estimates, not medical advice.
Today's log