Twenty minutes into the run, your head starts to throb. Or the pressure arrives while you are still racking the weights, and by the evening you have lost the day. It happens again the following week, and the conclusion writes itself: exercise causes your migraines, so exercise has to go.

Exertion is a real trigger for a sizeable minority. In Kelman's 2007 survey of 1,207 migraine patients in Cephalalgia, 22.1% named exercise among their triggers. Yet the same activity, repeated on a schedule, reduced attack frequency in controlled trials. So the useful answer is rarely to quit. It is to work out which of two different headaches you are getting, rule out the small number of dangerous causes, and then change how you train rather than whether you train.

Two headaches that arrive at the same moment

The International Classification of Headache Disorders, third edition, gives exertion its own diagnosis: 4.2 Primary exercise headache. The criteria are narrow. At least two episodes, brought on by and occurring only during or after strenuous physical exercise, lasting under 48 hours, with no intracranial disorder behind them.

The classification is explicit that this is not where exercise induced migraine goes. A migraine attack set off by a workout is coded as migraine, according to its own type or subtype. Same trigger, different disorder, different management.

Telling them apart at home comes down to what arrives with the pain. Primary exercise headache tends to be pain and not much else, described as pulsating in most respondents in the Vågå study the classification cites, and it settles once the exertion is over. A migraine brings its companions: nausea, light and sound sensitivity, the need for a dark room, the sluggish recovery day afterward.

The classification adds that primary exercise headache is more common in hot weather and high altitude, and that lifting has its own informal label, weight-lifters headache, recognized as a subtype but not separately classified.

The first bad one is a doctor visit, not a training question

This is the part to read twice. On the first occurrence of a headache with these characteristics, the classification says it is mandatory to exclude subarachnoid hemorrhage, arterial dissection, and reversible cerebral vasoconstriction syndrome. Those words are unusually firm for a diagnostic manual, and they are there because sudden severe headache during exertion is one of the ways serious vascular problems announce themselves.

None of that means your gym headache is an emergency. It means the first one earns a medical opinion rather than a forum search, particularly if it came on abruptly and hit peak intensity within seconds. Anything that arrives that fast, or that comes with weakness, confusion, vision loss, or a stiff neck and fever, belongs in urgent care today.

Why the same activity cuts both ways

A 2018 review in The Journal of Headache and Pain, written by Amin and colleagues for the European Headache Federation School of Advanced Studies, laid out both directions of the relationship. On the triggering side, proposed mechanisms include the acute release of calcitonin gene-related peptide during effort, along with changes in hypocretin and lactate metabolism. On the preventive side, plasma levels of beta-endorphin, endocannabinoids, and brain-derived neurotrophic factor rise after exercise.

Their conclusion is the sentence worth carrying around: although exercise can trigger attacks, regular exercise appears to have a preventive effect, most likely by shifting the threshold at which an attack starts in people who train consistently. The single hard session and the twelve-week habit are doing different things to the same brain.

Large population studies sit underneath that. Low levels of physical activity and high migraine frequency turn up together repeatedly, which does not settle which one leads, but does mean the people with the most attacks are often the people who have already stopped moving.

What the prevention trials actually deliver

The best known trial is Varkey and colleagues in Cephalalgia, 2011. Ninety-one adults with migraine were randomized to three months of one of three things: exercise for 40 minutes three times a week, a recorded relaxation program, or daily topiramate increased to each person's highest tolerable dose.

Attack frequency in the final month fell by a mean of 0.93 attacks in the exercise group, 0.83 in the relaxation group, and 0.97 in the topiramate group. The difference between the three was nowhere near significant, at p = 0.95. Exercise matched a standard preventive medication, which is the headline. The other half of the result deserves equal billing: all three arms moved attack counts by about one per month, so none of this is a cure.

A 2019 meta-analysis in The Journal of Headache and Pain, by Lemmens and colleagues at the University of Antwerp, pooled six studies and found a mean reduction of 0.6 plus or minus 0.3 migraine days per month after aerobic exercise treatment. Unpooled figures suggested attack duration dropped by 20% to 27% and pain intensity by 20% to 54%, though the outcome measures varied too much between studies to combine.

Modest, then, and real. If you are weighing whether it is worth restarting a routine that has hurt before, that is the size of prize on offer.

A program designed not to make things worse

Before the randomized trial, the same Swedish group ran a feasibility study, published in Headache in 2009, with an explicit goal: raise fitness in untrained migraine patients without making their migraines worse. Twenty-six patients cycled indoors three times a week for twelve weeks.

Maximum oxygen uptake rose from 32.9 to 36.2 mL/kg/minute. Quality of life improved, and so did attack frequency, symptom intensity, and medication intake. Across the whole twelve weeks, one patient had one migraine attack that started immediately after training. No other side effects were reported.

One attack, in twenty-six people, over twelve weeks. That is the number to hold against the fear that training will simply cost you more attacks than it saves. It also says something about how the program was built. The design started from untrained patients and a structured schedule, rather than from whatever intensity happened to be available on the day.

Your workout might not have started it

There is a complication that trigger diaries are bad at handling. A 2024 Cephalalgia paper from the International Headache Academy, led by Sebastianelli, set out the threshold hypothesis and made a point that reframes a lot of trigger hunting: attacks begin 24 to 48 hours before the headache phase, and the things people report as triggers may in fact be premonitory symptoms of an attack that is already under way.

Applied to exercise, this gets strange in a useful way. If the attack started yesterday afternoon, the restlessness that sent you to the gym, the neck stiffness you tried to stretch out, and the session that seemed to bring the pain on could all be the same event. The workout was a passenger, not the driver. That would explain a pattern many people describe, where exertion triggers an attack on some days and on plenty of other days does nothing at all.

I do not get migraines myself. The app came out of watching my mom and my wife manage theirs, and this is the question that memory handles worst: two weeks later, nobody can say whether Tuesday's session came before the bad day or after the yawning had already started. Some tracking apps record only the attack itself. MigrAid, for example, logs prodrome and attack as separate stages and allows custom triggers alongside its twelve built-in ones, which is what makes the order of events readable after the fact.

What to change before you give up training

Look at the conditions, not only the effort. The classification's own comment is that primary exercise headache occurs particularly in hot weather or at high altitude. If your bad sessions cluster in July or on trips to elevation, the environment is carrying part of the load, and heat is a documented factor in its own right.

Note the type of effort. The criteria describe sustained strenuous exercise as the usual precipitant, which distinguishes this from cough headache and its short bursts of straining. Sustained hard effort and brief maximal strain are not the same stimulus.

Record what happened around the session, not just the session. Sleep, food, the previous day's symptoms, the weather. Trigger tracking works by accumulation, and a single session tells you nothing that three months of sessions will not tell you better.

Take the pattern to a clinician rather than solving it alone. Exertional headaches that recur, worsen, or change character are worth a proper assessment, and the treatments that exist for primary exercise headache are prescribing decisions that sit with your doctor.

The bottom line

Exercise sits on both sides of the ledger, and the numbers on each side are known. Roughly one in five migraine patients names it as a trigger. Regular aerobic training cut attack frequency by 0.93 per month in the randomized trial, where it held its own against a preventive drug, and migraine days by about 0.6 per month across the pooled studies.

Quitting is the response with the worst evidence behind it. Working out which headache you get, having the first severe one checked, adjusting the conditions you train in, and keeping a record honest enough to show what came first: that is the response the research supports. Your own data will settle it faster than any study can.

Try MigrAid

Log prodrome and attack as separate stages, with your own custom triggers. See whether the workout came before the attack or after it started.

Download for iOS

References

International Classification of Headache Disorders, 3rd edition - 4.2 Primary exercise headache; Kelman L - The triggers or precipitants of the acute migraine attack, Cephalalgia (2007); Varkey E, Cider A, Carlsson J, Linde M - Exercise as migraine prophylaxis: a randomized study using relaxation and topiramate as controls, Cephalalgia (2011); Varkey E, Cider A, Carlsson J, Linde M - A study to evaluate the feasibility of an aerobic exercise program in patients with migraine, Headache (2009); Lemmens J, De Pauw J, Van Soom T, et al. - The effect of aerobic exercise on the number of migraine days, duration and pain intensity in migraine, The Journal of Headache and Pain (2019); Amin FM, Aristeidou S, Baraldi C, et al. - The association between migraine and physical exercise, The Journal of Headache and Pain (2018); Sebastianelli G, Atalar AC, Cetta I, et al. - Insights from triggers and prodromal symptoms on how migraine attacks start: The threshold hypothesis, Cephalalgia (2024).