Headaches are one of the few areas where caffeine is both a medicine and a cause. Caffeine is an ingredient in several over-the-counter headache tablets, and many people instinctively reach for a coffee when a headache starts. Yet caffeine withdrawal is one of the best-documented headache triggers there is, and frequent heavy use is linked to chronic headache. Understanding both sides explains why coffee helps some headaches, worsens others, and why the pattern of your caffeine use matters as much as the amount.
Caffeine as a painkiller booster
The strongest evidence for caffeine as a treatment comes from a Cochrane review, one of the most rigorous forms of evidence synthesis. Derry, Derry and Moore[1] assessed randomised, double-blind trials comparing a single dose of a painkiller plus caffeine with the same dose of the painkiller alone, across any type of acute pain. The review included 20 studies with 7,238 participants in valid comparisons, and the analyses of caffeine's effect covered 4,262 people. Most studies used paracetamol or ibuprofen with 100 to 130 mg of caffeine, and the most common conditions were dental pain after surgery, pain after childbirth, and headache.
Adding 100 mg or more of caffeine produced a small but statistically significant benefit that did not depend on the type of pain or the painkiller used. About 5% to 10% more participants achieved good pain relief, defined as at least half of the maximum possible relief over four to six hours. That gives a number needed to treat of about 14: for every 14 people who take a painkiller with caffeine rather than without, one more person gets good relief. The reviewers rated this as high-quality evidence and described the benefit as small but important.
Two things are worth noting. The benefit is modest; caffeine is a helper, not a strong painkiller on its own. And the review found only one serious adverse event with caffeine, which was judged unrelated to the medication, so in single doses for acute pain it appeared safe.
Caffeine in migraine treatment
Migraine is a specific type of headache, and caffeine has a particular reputation there. A review by Nowaczewska, Wiciński and Kaźmierczak[2] identified 7 studies evaluating caffeine in acute migraine treatment, and all of them found caffeine to be safe and effective, mostly in combination with other painkillers. The same review, however, also identified 21 studies on caffeine or caffeine withdrawal as a migraine trigger, with 17 of them finding it a trigger in a small percentage of participants, ranging from 2% to 30%. That dual role is the theme of this whole article.
Why caffeine can relieve headache
The trials in the Cochrane review were designed to test whether caffeine helps, not to explain why, and it is worth keeping those two questions apart. Several mechanisms have been proposed in the wider literature, including effects on blood vessels in the head and on how painkillers work, but the clinical evidence summarised here establishes the benefit rather than the mechanism. For the purpose of deciding whether a caffeine-containing painkiller is worth taking, the benefit is what matters.
There is a third, less comfortable explanation for why coffee often relieves headaches in regular drinkers: many of those headaches are caffeine withdrawal headaches, and coffee relieves them by ending the withdrawal. That is the other side of the story.
The withdrawal headache
The clearest demonstration comes from Silverman and colleagues, in the New England Journal of Medicine[3]. They studied 62 normal adults whose caffeine intake was low to moderate, an average of 235 mg a day, about two and a half cups of coffee. Participants ate caffeine-free diets and, under double-blind conditions, received capsules containing either their usual daily caffeine or placebo for two days at a time.
During the placebo period, 52% reported moderate or severe headache, compared with 2% during their normal diet and 6% during the caffeine capsule period. More people also reported unauthorised use of medication while on placebo, 13% compared with 2%, presumably to treat the symptoms. Fatigue, low vigour and low mood were also more common. The authors concluded that people who consume low or moderate amounts of caffeine may have a withdrawal syndrome when their daily consumption stops.
The notable part is how ordinary the intake was. These were not heavy drinkers; two and a half cups a day was enough for half of them to get a significant headache when caffeine was secretly removed.
When withdrawal headaches start and how long they last
A systematic review by Juliano and Griffiths[4] of 57 experimental and 9 survey studies validated headache as the leading symptom of caffeine withdrawal. In experimental studies, the incidence of headache was 50%, and clinically significant distress or impairment occurred in 13%. Symptoms typically began 12 to 24 hours after abstinence, peaked at 20 to 51 hours, and lasted for two to nine days. Symptoms generally became more frequent or severe with higher daily doses, but abstinence from as little as 100 mg a day, roughly one cup of coffee, could produce them.
That timeline explains some very common experiences. A weekend headache in someone who drinks coffee at work but sleeps late on Saturday and has their first cup hours later than usual. A headache on the first day of a fast, a religious observance or a hospital stay. A headache that disappears within an hour of a coffee. All of these fit the withdrawal pattern.
The surgery headache
One place the withdrawal headache turns up reliably is hospital. Patients are usually told to fast before an operation, which also means no morning coffee. Nikolajsen, Larsen and Kierkegaard, in the British Journal of Anaesthesia[5], surveyed 219 patients who fasted from midnight before minor surgery under general anaesthesia. After adjusting for other factors, patients whose daily caffeine consumption was above 400 mg had five times the odds of headache before their operation, and nearly four times the odds of headache afterwards, compared with lower consumers. People who usually had headaches more than twice a month, and those operated on after midday, were also at higher risk.
The later-in-the-day finding fits the withdrawal timeline: the longer since the last cup, the more likely the headache. It is a useful piece of information for anyone facing a procedure. Mentioning a heavy coffee habit to the care team is reasonable, and the headache that follows a morning of fasting may be caffeine withdrawal rather than a reaction to the anaesthetic.
Too much caffeine and chronic daily headache
Regular heavy caffeine use may also contribute to headaches becoming more frequent. Scher, Stewart and Lipton, in Neurology[6], compared 206 people with chronic daily headache, defined as 180 or more headache days a year, with 507 people with episodic headache, in a population-based study in three US cities. High caffeine exposure was defined as being in the top quarter of dietary intake or using a caffeine-containing over-the-counter painkiller as the preferred headache treatment.
People with chronic daily headache were more likely to have been high caffeine consumers before their chronic headaches began, with an odds ratio of 1.50. Current caffeine intake, after the headaches became chronic, was not significantly associated. The link was concentrated in women under 40, people with chronic episodic rather than continuous headache, those who had not consulted a doctor, and those whose chronic headaches had begun recently. The authors described dietary and medicinal caffeine as a modest risk factor for developing chronic daily headache.
Children, cola and daily headaches
Caffeine-related headache is not only an adult problem. Hering-Hanit and Gadoth, in Cephalalgia[7], described 36 children and adolescents, aged 6 to 18 with an average age of 9.2, seen over five years at a hospital headache clinic with daily or near-daily headache linked to heavy caffeine intake from cola drinks. All drank at least 1.5 litres of cola a day, averaging 11 litres a week, which the authors calculated as about 1,414 mg of caffeine weekly. After a gradual reduction in cola, headaches stopped completely in 33 of the 36, while the remaining three continued to have infrequent migraine.
This was a case series from one specialist clinic, not a controlled study, so it cannot say how common the problem is. But it shows two useful things: heavy caffeine intake from soft drinks can sustain daily headaches in young people, and a gradual withdrawal can resolve them without triggering withdrawal headaches along the way.
A large population picture from Norway
Hagen and colleagues[8] analysed data from 50,483 adults in the Nord-Trøndelag Health Survey in Norway. After adjusting for age, sex, smoking and education, high caffeine consumption was weakly but significantly associated with infrequent headache, an odds ratio of 1.16. But headache on more than 14 days a month was less likely among people with high caffeine consumption than among those with low consumption.
The authors offered two interpretations. High caffeine intake might turn chronic headaches into infrequent ones through its pain-relieving properties. Or, people with chronic headache might avoid caffeine because they have learned it aggravates their headaches, while people with infrequent headaches are less aware that caffeine could be contributing. This is cross-sectional data, so it cannot tell the two apart, but it illustrates how hard it is to study caffeine and headache in the general population.
Caffeine as a migraine trigger on the day
For people with migraine, the practical question is whether today's coffee raises the chance of an attack today. Mostofsky and colleagues, in the American Journal of Medicine[9], followed 98 adults with episodic migraine who completed electronic diaries every morning and evening for at least six weeks, recording caffeinated drinks, other lifestyle factors and headaches. In total they reported 825 migraines over 4,467 days.
By comparing each person's migraine rate on days with and without caffeinated drinks, the researchers found a statistically significant non-linear association. Estimates for each individual level of intake were not statistically significant, but the overall pattern suggested that high levels of caffeinated drink intake may trigger a migraine that day, while one or two servings were not clearly associated with attacks. The associations varied with people's habitual intake and with oral contraceptive use.
Why coffee before a migraine may be misleading
The review by Nowaczewska and colleagues[2] makes an important point about cause and effect. Before a migraine attack, many people experience premonitory symptoms, including yawning, low energy and sleepiness, which can last hours. Drinking coffee in response to those symptoms could make coffee look like the trigger when it is actually a response to an attack that was already starting. That is a real limitation of diary studies, and a reason not to assume every headache after coffee was caused by it.
The same review concluded that there was insufficient evidence to recommend stopping caffeine for all migraine patients, but that caffeine overuse may lead to migraine becoming chronic and sudden withdrawal may trigger attacks. It suggested migraine sufferers keep daily intake below 200 mg and keep it as consistent as possible to avoid withdrawal headaches.
The limits of this evidence
The painkiller evidence is strong, but it applies to single doses of combination products for acute pain, not to regular coffee drinking as headache prevention. The withdrawal evidence is robust and consistent. The chronic headache and migraine trigger evidence is weaker: case-control and cross-sectional designs that are vulnerable to recall bias and reverse causation, and a diary study with non-significant individual estimates. Most studies were done in American or European populations.
The practical takeaway
Caffeine does help headaches in a specific way: at 100 mg or more, it makes common painkillers work a little better, and it can be useful in acute migraine treatment, mostly in combination with other medicines. But caffeine also causes headaches when a regular habit is interrupted, from as little as about one cup a day, and high intake is linked to chronic daily headache and possibly to migraine attacks on high-intake days.
The consistent thread is regularity. Keeping caffeine intake moderate and steady from day to day, including on weekends, avoids the withdrawal headaches that are the most common coffee-related headache of all. If you want to cut back, reducing gradually over a week or more avoids them too, as described in our article on caffeine withdrawal. Frequent headaches, a new pattern of headache, or relying on painkillers several days a week deserve a medical assessment. Nothing here is medical advice.