Certain foods rich in magnesium, riboflavin, and omega-3 fatty acids can reduce how often migraines strike and how severe they feel. No single food is a cure, but building your diet around these nutrients, while keeping blood sugar steady and staying hydrated, gives your brain a more stable environment and fewer reasons to trigger an attack.
Magnesium-Rich Foods
Magnesium is one of the most studied nutrients in migraine prevention. Supplemental magnesium oxide at 400 to 600 mg per day is a standard recommendation for reducing migraine frequency, but food sources help you maintain a baseline between or instead of supplements. Dark leafy greens like spinach and kale are excellent sources, along with almonds, cashews, pumpkin seeds, black beans, and avocados. Whole grains like brown rice and quinoa contribute meaningful amounts too.
Many people with migraines have lower magnesium levels than average, and the mineral plays a direct role in nerve signaling and blood vessel function. If you’re not getting enough, your brain becomes more excitable and reactive to triggers. Pairing magnesium-rich foods throughout the day, rather than loading up at one meal, helps maintain steadier levels.
Foods High in Riboflavin (Vitamin B2)
Riboflavin supports your cells’ ability to produce energy, and migraine-prone brains appear to have higher energy demands. In a randomized trial, 400 mg per day of riboflavin reduced migraine attacks by two per month compared to placebo. The Canadian Headache Society recommends that same 400 mg dose for prevention, noting that side effects are minimal (mostly discolored urine).
Reaching 400 mg through food alone is difficult, since even the richest dietary sources fall well short of that therapeutic level. But riboflavin-rich foods still contribute to your overall intake and support the same energy pathways. The best sources include beef liver (2.9 mg per 3-ounce serving), fortified breakfast cereals (1.3 mg per serving), instant oats (1.1 mg per cup), plain yogurt (0.6 mg per cup), and milk (0.5 mg per cup). Eggs, lean meats, clams, almonds, and Swiss cheese all add smaller amounts. If you eat several of these daily and still fall short, a supplement can bridge the gap.
Fatty Fish and Omega-3s
A 16-week clinical trial funded by the National Institutes of Health found that diets higher in omega-3 fatty acids from fatty fish reduced both the frequency and severity of migraines. Participants eating more omega-3s had fewer headache days per month, fewer hours of headache overall, and less time spent in moderate-to-severe pain compared to those eating a typical American diet.
The study also found that the greatest benefit came when people increased omega-3s while simultaneously cutting back on omega-6 fatty acids, the type found in vegetable oils like soybean, corn, and sunflower oil. This matters practically: swapping fried foods cooked in vegetable oil for baked salmon or sardines gives you a double benefit. Aim for fatty fish like salmon, mackerel, sardines, herring, or trout two to three times per week. Walnuts, flaxseeds, and chia seeds provide a plant-based form of omega-3, though the type found in fish appears more potent for migraine reduction.
The Mediterranean Diet Pattern
Rather than focusing on single nutrients, the most consistent dietary evidence for migraine prevention points toward an overall eating pattern. Higher adherence to a Mediterranean-style diet is associated with lower migraine frequency, shorter attacks, and less disability. One study of 170 migraine patients found that those with low adherence to the diet experienced significantly more frequent episodes, including chronic migraines.
The pattern emphasizes extra-virgin olive oil at every meal, at least two servings of fresh vegetables daily, one to two servings of fruit, nuts daily, legumes at least twice a week, and fish two to three times a week. It limits red meat, processed meats, butter, and full-fat dairy. Many of the individual foods already discussed (leafy greens, nuts, fatty fish) are staples of this diet, which is part of why it works. Olive oil in particular contains compounds with anti-inflammatory properties, and the diet’s overall effect on inflammation likely explains much of its migraine benefit. Herbs like turmeric and fresh seasonings are encouraged as flavor additions.
Ginger for Acute Relief
Ginger stands out as a food with potential benefits during an active migraine, not just for prevention. A small comparison trial found that ginger powder was roughly similar to sumatriptan, a standard migraine medication, for acute relief. The evidence is limited, but given that ginger is safe, inexpensive, and easy to keep on hand, it’s worth trying. Fresh ginger steeped in hot water as a tea, or about a quarter teaspoon of ground ginger powder, is a reasonable amount during an attack.
Keeping Blood Sugar Stable
Skipping meals, especially breakfast, increases low-grade inflammation and disrupts glucose metabolism. While low blood sugar alone isn’t a reliable migraine trigger for everyone, the metabolic instability that comes from irregular eating patterns can lower your threshold for an attack. One randomized controlled trial found that a low-glycemic diet improved migraine frequency at a rate comparable to standard preventive medication.
In practical terms, this means choosing foods that release energy slowly: oats, sweet potatoes, whole grains, legumes, and most non-starchy vegetables. Pairing carbohydrates with protein or fat slows digestion further. Eating at regular intervals matters as much as what you eat. If you tend to skip meals or go long stretches without food, that habit alone could be contributing to your migraines more than any specific food trigger.
Staying Hydrated With Electrolyte-Rich Foods
Dehydration is one of the most common and most preventable migraine triggers. Plain water helps, but foods with high water content and natural electrolytes do double duty. Watermelon, strawberries, oranges, cucumbers, and tomatoes are all water-rich. Potassium-heavy options like bananas, potatoes, avocados, and spinach help your body retain fluid rather than flushing it through. Yogurt and milk provide a combination of water, potassium, and sodium that’s particularly effective for hydration.
Foods to Avoid or Handle Carefully
Tyramine, a compound that forms when proteins break down, is a well-known migraine trigger for some people. It builds up in aged, fermented, and improperly stored foods. The highest-risk items include aged cheeses (cheddar, blue cheese, parmesan), cured or smoked meats, fermented soy products like miso and soy sauce, and overripe fruit. Leftovers that sit in the fridge for several days also accumulate tyramine, particularly protein-rich dishes.
Safe swaps are straightforward. Fresh cheeses like ricotta, cottage cheese, and cream cheese are low in tyramine. Fresh meat and fish are fine as long as you eat them promptly after cooking or freeze leftovers within 48 hours. Canned tuna or chicken is safe if eaten right after opening. The general principle is freshness: the longer a protein-rich food sits, the more tyramine it develops.
Nitrates in processed meats (hot dogs, bacon, deli meat) and alcohol, particularly red wine and beer, are other common culprits. Not everyone with migraines reacts to the same triggers, so tracking your food intake alongside headache days for a few weeks can help you identify your personal patterns without unnecessarily restricting your diet.
Putting It Together
The most effective dietary approach to migraines combines adding protective foods with removing your personal triggers. A day built around oatmeal with almonds and yogurt for breakfast, a salad with spinach, beans, and olive oil for lunch, and salmon with sweet potatoes for dinner covers magnesium, riboflavin, omega-3s, and steady blood sugar in one natural eating pattern. Snacking on fruit and nuts between meals prevents the gaps that destabilize blood sugar. Keeping a water bottle nearby and including water-rich foods at meals addresses hydration.
Dietary changes take time to show results. Most studies on nutrients like riboflavin and omega-3s ran for three to four months before measuring benefits, so give any new eating pattern at least that long before judging whether it’s working. For people with frequent migraines, these foods won’t replace medical treatment, but they can meaningfully reduce how often attacks happen and how much they disrupt your life.