What Foods Help Headaches — and Which Ones Trigger Them

Several foods can help prevent or ease headaches, mostly by supplying nutrients your brain needs to regulate pain signals: magnesium, omega-3 fatty acids, B vitamins, and steady glucose. What you avoid matters too, since certain aged and processed foods are well-established headache triggers. Here’s what the evidence supports.

Fatty Fish and Omega-3s

Omega-3 fatty acids from fish are some of the strongest dietary tools against recurring headaches. A study of 182 people who experienced migraines 5 to 20 days per month found that 16 weeks on a diet higher in omega-3s from fatty fish reduced both the frequency and severity of headaches. Participants had fewer total headache hours, fewer moderate-to-severe headache hours per day, and fewer headache days per month compared to those eating a typical American diet.

The benefit was even greater when people also cut back on omega-6 fats, the type found in vegetable oils like soybean, corn, and sunflower oil. Salmon, mackerel, sardines, herring, and trout are the richest sources of the two omega-3s that drove these results. Aim for two or three servings of fatty fish per week, and consider cooking with olive oil instead of seed oils to shift the overall balance in your favor.

Magnesium-Rich Foods

Low magnesium levels are consistently linked to migraines, and supplementing with 600 mg of magnesium daily has been shown to be a safe, effective preventive strategy. While that dose is hard to hit through food alone, building magnesium into your diet creates a helpful baseline. Dark leafy greens like spinach and Swiss chard, pumpkin seeds, almonds, black beans, avocado, and dark chocolate (70% cacao or higher) are all concentrated sources.

A single ounce of pumpkin seeds delivers roughly 150 mg of magnesium, nearly 40% of the daily value. Pairing a few of these foods throughout the day can meaningfully raise your intake. If you get frequent migraines, a magnesium supplement may be worth discussing with your doctor, but the dietary foundation still matters.

Ginger for Acute Relief

Ginger stands out because it can help during a headache, not just prevent future ones. A clinical trial compared ginger powder to sumatriptan, one of the most commonly prescribed migraine medications. Two hours after treatment, both reduced headache severity by a similar amount. Ginger caused fewer side effects, and patients were equally willing to continue with either option.

The study used about an eighth of a teaspoon of ginger powder dissolved in water, taken at the first sign of a migraine. Fresh ginger steeped in hot water works too. Keep powdered ginger or a piece of fresh root on hand if you’re prone to headaches, since timing matters and early intervention works best.

B2-Rich Foods for Prevention

Vitamin B2 (riboflavin) plays a role in how your cells produce energy, and people with migraines often have less efficient energy metabolism in the brain. A randomized trial found that 400 mg of riboflavin daily reduced migraine frequency by two attacks per month compared to placebo. The Canadian Headache Society recommends that same dose for migraine prevention, noting that side effects are minimal (mainly bright yellow urine).

You won’t reach 400 mg through diet alone, since even the richest food sources contain only a few milligrams per serving. But regularly eating riboflavin-rich foods supports your baseline levels. The best sources include eggs, lean meats, milk, yogurt, almonds, and fortified cereals. A cup of plain yogurt provides about 0.6 mg, a cup of milk about 0.5 mg, and three ounces of beef liver a substantial 2.9 mg. If you’re considering a supplement, riboflavin is water-soluble, so excess is simply excreted.

Foods That Stabilize Blood Sugar

Skipping meals is one of the most common headache triggers, and the mechanism is straightforward. During extended periods without food, your brain’s stored glucose gets depleted, which can trigger the cascade of neural activity behind a headache or migraine with aura. Reactive hypoglycemia, where a sugary meal spikes your blood sugar and then causes it to crash, can do the same thing.

The fix is eating complex carbohydrates that release glucose slowly: oats, sweet potatoes, brown rice, quinoa, lentils, and whole grain bread. Pairing carbs with protein or fat slows absorption further. A low-glycemic diet has been specifically suggested as beneficial for migraine management because it reduces inflammation and provides a steadier fuel supply to the brain. If you notice headaches in the late afternoon or after long gaps between meals, this is likely the most relevant change you can make.

Water Before Anything Else

Dehydration headaches are among the easiest to fix. According to Harvard Health, a headache caused by dehydration typically resolves within one to two hours after drinking 16 to 32 ounces of water. That’s two to four glasses. If your headache appeared after exercise, time in the heat, or simply not drinking enough during the day, water should be your first response before reaching for food or medication.

CoQ10 in Everyday Foods

Coenzyme Q10 is a compound your cells use to produce energy, and multiple studies have found that supplementing with it reduces the number of migraine days per month, the duration of attacks, and the severity of pain. Doses in successful trials ranged from 100 to 400 mg daily. Your body makes some CoQ10 on its own, but production declines with age.

Dietary sources include meat, fish, eggs, nuts, and certain vegetables like broccoli and cauliflower. The amounts in food are relatively small compared to supplement doses, but they contribute to your overall levels. If you already eat a varied diet with some of the other foods on this list (fatty fish, eggs, nuts), you’re covering CoQ10 as well.

Caffeine: Helpful in Small Doses

Caffeine has a genuine but narrow role in headache relief. Doses of 100 to 130 mg (roughly one strong cup of coffee) enhance the effectiveness of pain relievers and can help on their own by constricting dilated blood vessels in the brain. That’s why caffeine appears in many over-the-counter headache medications.

The catch is dependence. Consuming 200 mg or more of caffeine daily for two weeks sets the stage for withdrawal headaches when you skip a day. Even 100 mg daily for a week can do it. If you use coffee to manage headaches, keep it occasional rather than daily, and stay under 200 mg on most days. For reference, an 8-ounce cup of drip coffee contains about 95 mg, a shot of espresso about 63 mg, and a cup of black tea about 47 mg.

Foods That Can Trigger Headaches

What you remove from your diet can be as important as what you add. The most common dietary headache triggers share a few chemicals: tyramine, nitrites, sulfites, and MSG. Tyramine builds up as foods age or ferment, which is why the worst offenders are aged cheeses (cheddar, blue, parmesan), cured meats (salami, pepperoni, bacon, hot dogs), fermented foods (sauerkraut, kimchi), and pickled or smoked fish. Overripe bananas and dried fruits like raisins contain both tyramine and sulfites.

Processed meats are a double problem because they contain both tyramine and nitrites, preservatives that dilate blood vessels. If you suspect food triggers but aren’t sure which ones, an elimination approach works well: remove the most common culprits for two to three weeks, then reintroduce them one at a time, spacing each reintroduction by a few days. Pizza is worth watching closely since it often combines aged cheese, processed meat, and sometimes MSG in one meal.

Putting It Together

A headache-friendly eating pattern isn’t complicated. It centers on fatty fish a few times a week, plenty of leafy greens and nuts for magnesium, eggs and dairy for B vitamins and CoQ10, complex carbohydrates at regular intervals, and consistent hydration. At the same time, it minimizes aged cheeses, cured meats, and highly processed foods. Fresh ginger and a modest cup of coffee can help during an active headache. Most of these changes overlap with a broadly healthy diet, which means the benefits extend well beyond your head.