What to Eat for a Headache: Foods That Help and Hurt

Certain foods can reduce headache frequency and intensity by addressing the most common underlying triggers: dehydration, low magnesium, blood sugar drops, and inflammation. What you eat (and when you eat it) matters more than most people realize, and a few dietary shifts can make a measurable difference.

Water Comes First

Chronic mild dehydration is one of the most overlooked headache triggers. In a randomized trial, people who added 1.5 liters of water per day to their routine scored 4.5 points higher on a migraine quality-of-life scale than controls. Nearly half of the water group reported meaningful improvement, compared to just 25% in the control group. The extra water didn’t eliminate headache days entirely, but it reduced the overall burden and severity of episodes.

If you’re prone to headaches, aim for consistent fluid intake throughout the day rather than trying to catch up after symptoms start. Plain water works. You don’t need electrolyte drinks unless you’re sweating heavily or exercising for extended periods.

Magnesium-Rich Foods for Prevention

Magnesium plays a direct role in migraine prevention. Clinical trials using supplemental magnesium at 500 to 600 mg per day have shown attack frequency reductions of roughly 40% compared to placebo. One study using 600 mg of magnesium citrate daily found a 41.6% drop in migraine frequency, versus 15.8% with placebo. That’s a meaningful gap.

You likely won’t hit therapeutic supplement doses through food alone, but building magnesium into your diet creates a consistent baseline. The best dietary sources include pumpkin seeds, almonds, cashews, black beans, spinach, avocado, dark chocolate, and whole grains. The Mediterranean diet, which emphasizes legumes, fish, whole grains, olive oil, vegetables, fruits, and nuts, is naturally rich in magnesium and B vitamins, both of which support headache prevention.

Omega-3 Fats Reduce Headache Days

Your body converts dietary fats into signaling molecules called oxylipins. Oxylipins from omega-3 fatty acids (found in fish and seafood) tend to reduce pain, while those from omega-6 fatty acids (found in vegetable oils like soybean, corn, and sunflower oil) tend to increase it. Most modern diets are heavily skewed toward omega-6.

A National Institutes of Health study found that people who increased their omega-3 intake had fewer total headache hours, fewer moderate-to-severe headache hours per day, and fewer headache days per month. Participants who also reduced their omega-6 intake saw even greater improvement than those who only added omega-3. The practical takeaway: eat more salmon, sardines, mackerel, herring, and trout, and cut back on fried foods and processed snacks made with vegetable oils.

Keep Your Blood Sugar Steady

Skipping meals or going long stretches without eating can trigger headaches through drops in blood sugar. Eating regularly, whether that’s three meals a day or smaller, more frequent meals, is associated with fewer and less severe migraines.

When you do eat, the type of carbohydrate matters. Low-glycemic foods release glucose slowly and keep your blood sugar stable, while high-glycemic foods cause a rapid spike followed by a crash. Low-glycemic choices (scored 1 to 55 on the glycemic index) include green vegetables, most fruits, raw carrots, kidney beans, chickpeas, and lentils. High-glycemic foods like white rice, white bread, and potatoes are more likely to cause the kind of blood sugar swings that set off a headache. Swapping white bread for whole-grain or rye bread, and white rice for lentils or sweet corn, can smooth out those fluctuations.

Ginger for Acute Relief

If a headache has already started, ginger is one of the few foods with direct evidence for acute relief. A double-blind trial of 100 migraine patients compared ginger powder to sumatriptan, a standard prescription migraine drug. Two hours after treatment, both groups experienced a significant decrease in headache severity, and the effectiveness was statistically comparable. Ginger had fewer side effects, and patients were equally willing to continue with either treatment.

The study used roughly a quarter teaspoon of ginger powder mixed into water at the onset of a migraine. Fresh ginger steeped in hot water as a tea is another option, though the exact dose is harder to control. It won’t work for every headache, but it’s a low-risk option worth trying before reaching for medication.

Riboflavin and CoQ10 in Food

Riboflavin (vitamin B2) has strong evidence for migraine prevention. In clinical studies using 400 mg per day, headache frequency dropped from an average of 4 days per month to 2 days per month after three months. That dose is far higher than what you’d get from food, but dietary riboflavin still contributes. Good sources include eggs, lean meats, dairy, almonds, mushrooms, and fortified cereals.

Coenzyme Q10, a compound your cells use to produce energy, also shows promise. Doses of 100 to 400 mg per day in clinical trials have reduced migraine frequency, duration, and severity across multiple studies. One trial at 400 mg per day over three months found reductions in all three measures. Foods containing CoQ10 include organ meats, beef, sardines, mackerel, peanuts, spinach, and broccoli. As with riboflavin, supplement doses in studies far exceed what diet provides, but these foods still support your overall intake.

Caffeine: Helpful in Small Doses, Harmful in Large Ones

Caffeine has a genuine pain-relieving effect. At 100 mg or more (roughly one cup of coffee), it boosts the effectiveness of standard pain relievers and can help abort a headache in progress. But regular consumption above 200 mg per day (about two cups of coffee) creates dependence. If you suddenly skip your usual caffeine, a withdrawal headache typically starts within 24 hours and can last up to a week.

The safest approach is to keep daily caffeine under 200 mg. If you use caffeine strategically for headache relief, keep it occasional rather than daily so your body doesn’t develop tolerance.

Foods That Can Trigger Headaches

Some foods contain compounds that actively provoke headaches in susceptible people. The two main culprits are histamine and tyramine, both naturally occurring chemicals that affect blood vessels and neurotransmitter activity. Common high-histamine foods include aged cheeses, red wine, fermented foods like soy sauce and sauerkraut, processed meats, tomatoes, eggplant, and spinach. Strawberries, nuts, and lentils also contain histamine, though their overall nutritional benefits may outweigh the risk for many people.

Condiments and processed foods add another layer of triggers. Ketchup, mayonnaise, mustard, and packaged breads often contain additives like monosodium glutamate (MSG), preservatives, and artificial colorants that can provoke headaches independently of histamine. Red wine is a particularly common trigger because it combines histamine, tyramine, tannins, and alcohol in a single glass.

Not everyone reacts to the same foods. If you suspect dietary triggers, try removing the most common offenders for two to three weeks and reintroduce them one at a time. Keeping a food diary alongside a headache log makes patterns easier to spot.

Putting It Together

A headache-friendly eating pattern looks a lot like the Mediterranean diet: fish two to three times per week, plenty of vegetables, legumes, whole grains, nuts, and olive oil as your primary cooking fat. Pair that with consistent hydration, regular meal timing, and limited processed food. Minimize vegetable oils high in omega-6, keep caffeine moderate, and pay attention to any personal triggers among the high-histamine foods. These aren’t dramatic changes, but they address the most evidence-backed dietary factors behind recurring headaches.