What Foods Help with Headaches and Which to Avoid

Several everyday foods can help prevent or ease headaches by supplying nutrients your brain needs to regulate pain signals, blood flow, and inflammation. The most effective options are rich in magnesium, riboflavin (vitamin B2), or compounds that stabilize blood sugar and hydration. Knowing which foods to reach for, and which to avoid, can make a real difference in how often headaches show up.

Magnesium-Rich Foods

Magnesium is one of the most well-studied nutrients for headache prevention. It works by calming overactive nerve signals involved in pain transmission and by reducing levels of a protein called CGRP that dilates blood vessels inside the skull. When those vessels expand too much, they press on surrounding tissue and generate pain. Magnesium helps keep that process in check and also influences blood flow to the brain through its effect on nitric oxide.

Pumpkin seeds are the single best food source, delivering 150 mg of magnesium per ounce (about a small handful). Other top options per serving:

  • Chia seeds: 111 mg per ounce
  • Almonds (roasted): 80 mg per ounce
  • Spinach (cooked): 78 mg per half cup
  • Swiss chard (cooked): 75 mg per half cup
  • Cashews (roasted): 72 mg per ounce
  • Dark chocolate (70%+ cocoa): 64 mg per ounce
  • Black beans (boiled): 60 mg per half cup
  • Quinoa (cooked): 60 mg per half cup
  • Avocado: 58 mg per whole fruit

You don’t need to eat all of these in one day. A realistic approach is to mix a few into your regular meals: spinach in a lunch salad, pumpkin seeds on oatmeal, black beans at dinner. Consistency matters more than hitting a specific number on any single day.

Foods High in Riboflavin (Vitamin B2)

Both the American Academy of Neurology and the Canadian Headache Society recognize riboflavin as likely effective for migraine prevention. The therapeutic dose studied in trials is 400 mg per day, which realistically requires a supplement. But building a riboflavin-rich diet still contributes to your baseline levels and supports the cellular energy production your brain depends on.

The richest food sources include eggs, lean meats, milk, and yogurt. Beef liver stands out dramatically at 2.9 mg per 3-ounce serving (223% of the daily value). More practical everyday choices include plain yogurt (0.6 mg per cup), milk (0.5 mg per cup), fortified oatmeal (1.1 mg per cup), almonds (0.3 mg per ounce), and Swiss cheese (0.3 mg per 3 ounces). Fortified breakfast cereals can deliver up to 1.3 mg per serving, making them one of the easiest ways to boost your intake.

Ginger

Ginger has a surprisingly strong track record for acute headache relief. In a clinical trial published in Phytotherapy Research, 250 mg of ginger powder reduced migraine pain by 4.6 points on a 10-point scale, nearly identical to the 4.7-point reduction seen with sumatriptan, a commonly prescribed migraine medication. Side effects were minimal: only about 1 in 34 people experienced any negative reaction.

You can work ginger into your diet through fresh ginger sliced into hot water or tea, grated into stir-fries, or blended into smoothies. For headache relief in the moment, ginger tea made from fresh root is the most practical option. Powdered ginger in capsule form mirrors what was used in the trial, but even culinary amounts may offer some benefit over time.

Complex Carbohydrates for Blood Sugar Stability

Blood sugar crashes are a common and often overlooked headache trigger. When you eat refined carbohydrates like white bread, sugary snacks, or sweetened drinks, your blood sugar spikes fast and then drops just as quickly. That rapid drop, called reactive hypoglycemia, directly causes headaches along with dizziness and difficulty concentrating.

Complex carbohydrates prevent this cycle because they break down gradually, creating a slow, steady rise in blood sugar instead of a spike. The best choices include oatmeal, brown or wild rice, quinoa, sweet potatoes with the skin on, barley, legumes (black beans, lentils, chickpeas), and sprouted grain breads. Pairing these with a source of protein or healthy fat slows digestion even further. A bowl of oatmeal with almonds and chia seeds, for example, combines blood sugar stability with a strong dose of magnesium.

If you tend to get headaches in the late afternoon, skipping meals or going long stretches without eating is a likely contributor. Keeping a stash of nuts, bean-based snacks, or whole grain crackers with cheese can prevent the glucose dip that sets headaches in motion.

Water-Rich Foods and Hydration

Even mild dehydration can trigger headaches. When your body loses too much fluid, brain tissue temporarily contracts slightly, pulling on pain-sensitive structures surrounding the brain and reducing blood flow. The result is a dull, pressing headache that often comes with trouble concentrating.

Plain water is the obvious fix, but water-rich foods help you stay hydrated between glasses. Cucumbers, watermelon, strawberries, oranges, celery, and lettuce all contain over 90% water by weight. Soups and broths count too, with the added benefit of replacing electrolytes. If you find yourself prone to headaches on days when you don’t drink much, adding these foods to your meals can close the gap.

Coffee: Helpful and Harmful

Caffeine has a genuine pain-relieving effect on headaches. It works by blocking adenosine, a chemical in your brain that dilates blood vessels. By preventing that dilation, caffeine narrows the swollen vessels that contribute to headache pain. This is why caffeine appears in many over-the-counter headache medications.

The catch is that regular caffeine use creates dependence. If you drink coffee every day and then skip it, the resulting rebound headache can be worse than what you started with. A small cup of coffee or tea can help when a headache is coming on, but relying on it daily for prevention tends to backfire. Keeping your intake moderate and consistent, rather than swinging between heavy use and none, is the most headache-friendly approach.

Foods That Make Headaches Worse

Some foods actively trigger headaches, especially in people prone to migraines. Tyramine, a compound that forms when proteins break down over time, is one of the most reliable dietary triggers. It causes a sharp increase in blood pressure that produces sudden, severe headaches in susceptible people.

The highest-tyramine foods share a common theme: they’re aged, fermented, or cured. The main ones to watch for:

  • Aged cheeses: cheddar, parmesan, camembert, gouda, gruyere, Roquefort, stilton, provolone
  • Cured and dried meats: salami, pepperoni, jerky, mortadella
  • Fermented foods: sauerkraut, kimchi, miso, tempeh
  • Soy-based sauces: soy sauce, teriyaki, hoisin, fish sauce
  • Certain alcohols: unpasteurized beer, homemade wine, craft beers with visible sediment
  • Improperly stored meat or fish: anything with off colors, odors, or visible mold

Overripe fruit also accumulates tyramine. A perfectly ripe banana is fine, but one that’s gone brown and mushy contains significantly more. Freshness matters across the board: the longer a protein-rich food sits, the more tyramine it develops. Eating leftovers within a day or two and choosing fresh over aged versions of cheese and meat reduces your exposure considerably.

Putting It Together

The most headache-friendly eating pattern combines several of these strategies at once. A day built around whole grains, leafy greens, nuts, seeds, lean protein, and plenty of water covers magnesium, riboflavin, blood sugar stability, and hydration simultaneously. Adding ginger tea and keeping caffeine intake steady rather than erratic addresses acute pain relief. Cutting back on aged cheeses, cured meats, and fermented condiments removes common triggers. None of these changes require a dramatic overhaul. Small, consistent shifts in what you eat day to day can reduce both the frequency and severity of headaches over weeks and months.