Caffeine works by blocking adenosine receptors in the brain. Adenosine is the chemical that builds up during wakefulness and makes you feel sleepy. When caffeine blocks the receptors, you do not feel the sleepiness — but the adenosine keeps accumulating. When the caffeine clears, all that accumulated adenosine hits at once, producing the afternoon crash.
The half-life
Caffeine's average half-life is 5 hours, but it varies enormously: 3 hours in fast metabolizers, 7+ hours in slow metabolizers, and up to 11 hours in pregnant women and people on oral contraceptives. The CYP1A2 gene determines your metabolism speed; genetic testing can identify your variant. Smokers metabolize caffeine 50% faster; pregnant women metabolize it 50% slower.
Why sleep disruption is invisible
Caffeine does not usually prevent sleep onset. Instead, it fragments deep sleep (stages 3 and 4) and reduces total sleep time by 10-30 minutes. You wake up feeling "fine" but slightly tired, reach for more coffee, and the cycle compounds. A 2013 study found that 400 mg of caffeine taken 6 hours before bedtime reduced sleep quality by 20% — even though subjects reported no sleep problems.
When to stop
The general rule: stop caffeine 8-10 hours before bedtime for normal metabolizers, 12+ hours for slow metabolizers. For a 11 PM bedtime, that means no caffeine after 1-3 PM. If you must have an afternoon coffee, switch to half-caf or decaf after 2 PM. The "safe cutoff" in this calculator is based on getting caffeine below 20 mg at your bedtime.