Yes, stomach issues can cause headaches, and the connection is more direct than most people realize. Your gut and brain are in constant two-way communication through a network of nerves, chemical messengers, and immune signals. When something goes wrong in your digestive system, whether it’s inflammation, an infection, or a chronic condition like irritable bowel syndrome, the effects can travel upward and trigger headaches or make existing migraines worse.
How Your Gut Talks to Your Brain
The gut and brain are physically wired together through the vagus nerve, a long nerve that runs from the brainstem down to the abdomen. This connection, often called the gut-brain axis, allows signals to flow in both directions. Your digestive tract also produces many of the same chemical messengers your brain uses, including serotonin, dopamine, and a pain-signaling molecule called CGRP. Disruptions to any of these shared systems can produce symptoms in both your gut and your head simultaneously.
Serotonin is the clearest example. About 95% of your body’s serotonin is produced in the gut, where it regulates digestion, stimulates acid secretion, and controls the movement of food through your intestines. But serotonin also plays a central role in migraine. The raw material for making serotonin is an amino acid called tryptophan, so anything that alters how your gut processes tryptophan can shift serotonin levels in the brain. People with IBS, for instance, tend to have higher circulating serotonin levels and altered serotonin processing compared to healthy individuals, which helps explain why digestive disorders and headaches so often overlap.
Gut Inflammation and the Pain Pathway
When the lining of your intestines becomes damaged or overly permeable (sometimes called “leaky gut”), bacterial toxins can slip into the bloodstream and trigger a widespread inflammatory response. This matters for headaches because the same inflammatory molecules that surge during gut problems, including TNF-alpha, IL-1 beta, and IL-6, can activate the trigeminal nerve system. The trigeminal nerve is the primary pain pathway involved in migraines and many tension-type headaches.
This creates a feedback loop. Inflammation makes the gut lining more permeable, which lets more toxins through, which fuels more inflammation, which keeps stimulating pain pathways in the head. Certain gut bacteria make this worse. Some species degrade the intestinal barrier, increasing permeability and trigeminal nerve activation. Others, particularly beneficial strains that produce short-chain fatty acids, help strengthen the gut lining and reduce neuroinflammation.
IBS, GERD, and Headache Overlap
The overlap between specific digestive conditions and headaches is well documented. Among patients diagnosed with IBS at a large tertiary medical center, 17.7% also had migraines. That’s considerably higher than the general population rate. The shared serotonin dysfunction and chronic low-grade inflammation in IBS likely explain much of this overlap.
Gastroesophageal reflux disease (GERD) shows a similar pattern. A multicenter study of children with primary headaches found that those with GERD were 2.3 times more likely to have migraine without aura than those without reflux. In adults, depression appears to act as a mediating factor between the two conditions, meaning GERD, mood changes, and migraines can form a connected chain rather than existing independently.
Celiac Disease and Headaches
Celiac disease deserves special attention because treating the gut problem often eliminates the headaches entirely. About 26% of adults with celiac disease experience headaches, and in children the figure is around 18%. These aren’t minor headaches. Many patients with celiac disease are initially diagnosed with “idiopathic headache,” meaning no one can find a cause, before the underlying gluten sensitivity is identified.
The effect of removing gluten is striking. A gluten-free diet leads to complete headache resolution in up to 75% of adult patients and 71% of children with celiac disease. Even among those who don’t get full resolution, between 52% and 100% of adults report a significant reduction in headache frequency after going gluten-free. This is one of the clearest examples in medicine of a stomach problem directly driving headaches, and of fixing the gut fixing the head.
H. Pylori Infection as a Headache Trigger
H. pylori, the bacterium responsible for most stomach ulcers, has also been linked to migraines. A systematic review found a consistent association between chronic H. pylori infection and increased migraine risk, particularly in Asian populations. In one randomized controlled trial, patients who received treatment to eliminate H. pylori saw significantly greater improvement in migraine disability scores compared to a control group. Across the broader research, 76% of migraine patients with H. pylori infection reported a significant reduction in both the frequency and severity of their migraine attacks after the infection was cleared.
The mechanism likely involves the chronic inflammation H. pylori causes in the stomach lining, which raises systemic inflammatory markers and may sensitize the trigeminal pain pathway over time. If you have unexplained migraines along with symptoms like stomach burning, nausea, or bloating, H. pylori is worth investigating with a simple breath or stool test.
Abdominal Migraines
Some people, particularly children, experience what’s called abdominal migraine: episodes of intense midline abdominal pain lasting anywhere from one hour to three days, accompanied by nausea, vomiting, loss of appetite, sensitivity to light, and pallor. These episodes come and go with symptom-free intervals in between, and they follow a recognizable pattern for each person. The pain is severe enough to disrupt normal activities.
The International Classification of Headache Disorders classifies abdominal migraine as a headache-related disorder, even though head pain is often absent during the abdominal episodes. Many children with abdominal migraines go on to develop traditional migraines later in life. While the condition is formally recognized only in pediatric diagnostic criteria, adults can experience it too, though it remains underdiagnosed in older patients.
Stomach Problems Can Block Headache Treatment
There’s another way stomach issues worsen headaches that people rarely consider: delayed gastric emptying. During a migraine attack, the stomach often slows down dramatically, a condition called gastric stasis. This means oral pain medications sit in the stomach instead of moving into the small intestine where they’re absorbed. The result is delayed peak blood levels of the medication, which translates to slower and weaker pain relief.
This creates a frustrating cycle. You take a painkiller for your migraine, but because the migraine itself has slowed your stomach, the medication doesn’t work well or takes much longer to kick in. People with pre-existing gastroparesis or other motility disorders face this problem even outside of migraine attacks. For those who find oral medications consistently ineffective, this stomach-related absorption issue is often the reason.
Improving Gut Health to Reduce Headaches
Because the gut-brain connection runs in both directions, improving digestive health can reduce headache frequency for some people. In a triple-blinded, placebo-controlled trial, migraine patients who took a multi-strain probiotic supplement along with vitamin D for 12 weeks experienced significantly greater reductions in migraine frequency (about 3.2 fewer attacks) compared to the placebo group (about 1.25 fewer attacks). Migraine severity also dropped meaningfully in the probiotic group while it actually increased slightly in the placebo group.
The probiotic used contained eight bacterial strains spanning Lactobacillus and Bifidobacterium species. While the duration of individual headache episodes didn’t change significantly, the reduction in how often migraines occurred and how intense they felt was clinically meaningful. This is still an area where larger trials are needed, but it reinforces the principle that what happens in the gut doesn’t stay in the gut.
If you experience both chronic digestive symptoms and recurring headaches, treating them as potentially related rather than as two separate problems can change the approach entirely. Conditions like celiac disease, H. pylori infection, and IBS all have established links to headaches, and in many cases, addressing the underlying gut issue reduces or eliminates head pain that seemed unrelated.

