What Foods Help With Headaches and What to Avoid

Several nutrients have strong evidence for reducing headache frequency and severity, and you can get most of them from everyday foods. Magnesium, omega-3 fatty acids, riboflavin (vitamin B2), and ginger top the list, each working through different mechanisms to calm overactive nerve signaling, reduce inflammation, or relax blood vessels. Beyond adding helpful foods, avoiding common triggers and keeping your blood sugar and hydration steady can make a noticeable difference.

Magnesium-Rich Foods

Magnesium is one of the most studied nutrients for headache prevention, particularly migraines. It helps regulate nerve signaling and blood vessel tone, and people who get frequent headaches tend to have lower magnesium levels. Clinical trials using up to 600 mg of magnesium daily found modest but real reductions in migraine frequency, and a review on migraine prevention suggested 300 mg twice a day as an effective dose.

You can build toward that level through food. Pumpkin seeds are the standout source: a single ounce of roasted pumpkin seeds delivers 156 mg of magnesium. An ounce of chia seeds provides 111 mg. After that, almonds (80 mg per ounce), spinach (78 mg per half cup cooked), and cashews (74 mg per ounce) are all reliable sources. Black beans, edamame, and peanuts round out the list in the 50 to 63 mg range per serving. A handful of pumpkin seeds on a salad with spinach and black beans gets you well over 200 mg in a single meal.

Omega-3 Fatty Acids

A study funded by the National Institutes of Health assigned 182 people who experienced migraines 5 to 20 days per month to one of three diets for 16 weeks. Those who ate more omega-3 fatty acids (the kind found in fatty fish) had fewer headache days per month, fewer total hours of headache, and fewer hours of moderate-to-severe pain compared to the control group eating a typical American diet. The group that also reduced their intake of omega-6 fats (common in vegetable oils and processed foods) saw the greatest improvement.

The practical takeaway: eat more salmon, sardines, mackerel, herring, and trout. These are the richest whole-food sources of the specific omega-3s (EPA and DHA) used in the study. At the same time, cutting back on fried foods, packaged snacks, and cooking oils high in omega-6 (soybean, corn, sunflower) may amplify the benefit. Aim for two to three servings of fatty fish per week as a starting point.

Riboflavin (Vitamin B2)

The American Academy of Neurology and the American Headache Society have both concluded that riboflavin is probably effective for preventing migraines. The Canadian Headache Society specifically recommends 400 mg per day for migraine prevention, noting that side effects are minimal (mostly discolored urine).

That 400 mg dose is far higher than what food alone provides, so supplementation is usually needed for a therapeutic effect. Still, building a riboflavin-rich diet supports your baseline levels. Beef liver is the most concentrated source at 2.9 mg per 3-ounce serving. A cup of plain yogurt provides about 0.6 mg, a cup of milk adds 0.5 mg, and eggs, lean beef, clams, almonds, and Swiss cheese each contribute meaningful amounts. Fortified cereals and instant oats are another easy way to boost intake, delivering 1.1 to 1.3 mg per serving.

Ginger for Acute Headache Relief

If you already have a headache and want relief, ginger is worth trying. A clinical trial published in Phytotherapy Research compared 250 mg of ginger powder to 50 mg of sumatriptan (a common prescription migraine drug) and found their effectiveness was similar. Two hours after treatment, the sumatriptan group saw a 4.7-point reduction in pain severity while the ginger group saw a 4.6-point reduction. About 70% of sumatriptan users and 64% of ginger users experienced 90% or greater pain relief within two hours.

The ginger group also reported far fewer side effects: only 4% experienced complaints compared to 20% in the sumatriptan group. While this was a single study, the results are encouraging. Fresh ginger tea (sliced ginger root steeped in hot water for 10 to 15 minutes) is the simplest way to try this at home. Ground ginger added to smoothies or meals works too.

Hydration and Electrolyte Balance

Dehydration is one of the most common and overlooked headache triggers. When your body loses fluid, blood volume drops, blood pressure falls, and nerve cells can misfire more easily. A dehydration headache typically resolves within a few hours of drinking water and resting, according to the Cleveland Clinic, making this one of the fastest fixes available.

Plain water handles mild cases, but electrolytes matter when dehydration is more significant. Sodium, potassium, magnesium, and calcium all help regulate the nerve signaling and blood vessel tone involved in headaches. Too little sodium reduces blood volume and alters nerve transmission. Low potassium worsens fatigue and headache. Bone broth and soups are excellent for restoring sodium. Bananas, potatoes, avocados, and coconut water are reliable potassium sources. Yogurt covers calcium, potassium, and some sodium in one food. If you’re prone to headaches on hot days or after exercise, pairing water with electrolyte-containing foods is more effective than water alone.

Steady Blood Sugar Prevents Headaches

Skipping meals or eating foods that spike and crash your blood sugar can trigger headaches on their own. When blood sugar drops sharply, your body releases stress hormones that constrict blood vessels, and the rebound effect often shows up as a throbbing headache. This is especially common in people prone to migraines.

Low-glycemic complex carbohydrates release energy gradually, keeping blood sugar stable for hours. Quinoa, sweet potatoes, lentils, chickpeas, and oats are all strong choices. Pairing carbohydrates with protein or fat slows digestion further. A breakfast of oatmeal with almonds and chia seeds, for example, combines blood-sugar stability with a significant dose of magnesium and riboflavin. Eating every three to four hours rather than going long stretches without food is one of the simplest dietary changes you can make for headache prevention.

Caffeine: Helper or Trigger

Caffeine narrows blood vessels in the brain, which is why it shows up in many over-the-counter headache medications. A cup of coffee at the right moment can genuinely ease a headache. But the window between helpful and harmful is narrow and varies from person to person.

Doctors generally recommend that people with episodic migraines limit caffeine to one or two beverages daily, or roughly 200 mg. Beyond that, you risk building a dependency that takes as little as seven days to develop and only 100 mg per day (about one small coffee) to sustain. Once dependency sets in, missing your usual dose triggers a rebound headache. If you currently drink several cups of coffee a day and get frequent headaches, gradually reducing your intake over a week or two is a reasonable experiment.

Foods That Can Trigger Headaches

While adding the right foods helps, avoiding the wrong ones matters just as much during an active headache or if you’re prone to them. Tyramine, a compound that forms naturally when the amino acid tyrosine breaks down, is a well-known migraine trigger. It builds up in foods that are aged, fermented, or stored for long periods. The National Headache Foundation flags aged cheeses (cheddar, blue cheese, brie), cured meats (salami, pepperoni, bacon), fermented foods (sauerkraut, kimchi, soy sauce), and leftover proteins stored for more than a day or two.

Alcohol, particularly red wine and beer, is another common trigger because it contains both tyramine and histamine. Highly processed foods with nitrates, MSG, or artificial sweeteners bother some people as well. Keeping a simple food diary for a few weeks is the most reliable way to identify your personal triggers, since sensitivity varies widely from one person to the next.

Putting It All Together

A headache-friendly diet doesn’t require a dramatic overhaul. The pattern that emerges from the research is straightforward: eat regular meals built around whole foods, prioritize magnesium-rich seeds and greens, include fatty fish two to three times a week, stay hydrated with electrolyte-containing foods and beverages, and keep blood sugar steady with complex carbohydrates paired with protein. Keep ginger on hand for acute episodes. Limit caffeine to 200 mg or less, and pay attention to aged, fermented, or highly processed foods that may be personal triggers.

Most of these changes overlap with each other. A lunch of salmon over quinoa with spinach and pumpkin seeds, for instance, covers omega-3s, magnesium, complex carbohydrates, and riboflavin in a single meal. Small, consistent shifts in what you eat every day tend to produce more meaningful results than any single supplement or superfood.