Magnesium-Rich Foods for Migraines: What Does the Evidence Say?
Magnesium-rich foods can be a practical way to increase your everyday magnesium intake. Pumpkin seeds, chia seeds, almonds, spinach, black beans and whole grains are among the better sources.
But can eating more magnesium actually prevent migraine attacks?
Magnesium has a recognized role in migraine prevention, but most clinical trials have studied magnesium supplements at specific doses—not magnesium obtained from food alone. A magnesium-rich diet can support adequate nutrition and overall health, but it should not be presented as a replacement for an evidence-based migraine treatment plan.
Quick answer
-
Magnesium is involved in nerve signalling, energy production and muscle function.
-
Research suggests magnesium supplements may help reduce migraine frequency for some people.
-
Most migraine studies have evaluated supplements rather than magnesium-rich foods.
-
Pumpkin seeds, chia seeds, almonds, spinach, beans and whole grains are among the best dietary sources.
-
Observational research has found an association between higher dietary magnesium intake and lower odds of migraine, but it cannot establish that magnesium-rich foods prevent attacks.
-
Food is a sensible foundation, but it may not provide the elemental magnesium doses used in migraine-prevention trials.
-
Magnesium supplements can cause diarrhea or stomach upset and may not be appropriate for people with impaired kidney function.
Why does magnesium matter for migraine?
Magnesium is an essential mineral involved in hundreds of reactions throughout the body. It contributes to normal nerve and muscle function, energy production, blood pressure regulation and glucose control (NIH Office of Dietary Supplements).
These functions may be relevant to migraine because migraine involves changes in how the nervous system processes sensory information and pain. Magnesium may influence several processes involved in migraine biology, including energy metabolism, neuronal excitability, neurotransmitter release and cortical spreading depression—the wave of altered brain activity associated with migraine aura (Gross et al., 2019).
Researchers have also examined whether magnesium intake differs between people with and without migraine. In a cross-sectional analysis of U.S. nutrition survey data, higher dietary magnesium intake was associated with lower odds of migraine or severe headache (Slavin et al., 2021).
That finding is interesting, but it does not prove that increasing dietary magnesium will prevent migraine attacks. Cross-sectional studies can identify an association at one point in time, but they cannot establish which factor caused the outcome.
Can magnesium help prevent migraine attacks?
Magnesium is one of the more established supplements used for migraine prevention.
A review of existing migraine guidelines reported that magnesium citrate received a strong recommendation from the Canadian Headache Society and that magnesium was classified as “probably effective” in earlier guidance from the American Academy of Neurology and American Headache Society (Rajapakse and Pringsheim, 2016).
The 2023 VA/DoD clinical practice guideline also suggests oral magnesium for the prevention of migraine, although it describes the overall quality of evidence as low (VA/DoD Clinical Practice Guideline for the Management of Headache, 2023).
A 2024 systematic review and meta-analysis found that magnesium supplementation reduced migraine attacks and monthly migraine days compared with control treatments. The authors reported an average reduction of approximately 1.7 monthly migraine days, although results varied between trials (Khan et al., 2024).
Researchers are continuing to assess the effectiveness and safety of oral magnesium across randomized trials. A recent Cochrane review protocol outlines plans to evaluate magnesium supplementation for migraine prevention, including differences between doses, formulations and treatment durations (Rodriguez et al., 2025).
The distinction between food and supplements matters. These migraine-prevention trials generally evaluated magnesium supplements at defined doses. They did not establish that eating a particular magnesium-rich food—or following a high-magnesium diet by itself—will prevent attacks.
A magnesium-rich diet can help someone meet their nutritional needs. Whether a magnesium supplement should also be considered is a separate clinical question.
What does the research say about dietary magnesium and migraine?
Research on magnesium supplements is more developed than research on magnesium-rich foods.
In the 2021 National Health and Nutrition Examination Survey analysis, adults with higher dietary magnesium intake had lower odds of reporting migraine or severe headache. The association was particularly notable among women, but the study relied on self-reported dietary intake and headache history (Slavin et al., 2021).
This study supports the possibility that dietary magnesium may be relevant to migraine. It does not show that adding pumpkin seeds, spinach or another individual food will reduce migraine frequency.
People who consume more magnesium may also differ in other important ways. They may have different overall diets, health behaviours or medical histories. Controlled trials would be needed to determine whether increasing magnesium through food directly prevents attacks.
For now, the most accurate conclusion is that magnesium-rich foods are a nutritious foundation, while magnesium supplements have the more direct clinical evidence for migraine prevention.
What are the best magnesium-rich foods for migraines?
There is no special category of magnesium foods that works only for migraine. The best choices are foods that provide meaningful amounts of magnesium and fit comfortably into your regular diet.
The NIH identifies seeds, nuts, legumes, leafy green vegetables and whole grains as important dietary sources of magnesium (NIH Office of Dietary Supplements).
Seeds
Seeds are among the most concentrated dietary sources of magnesium.
Good choices include:
-
Pumpkin seeds
-
Chia seeds
-
Flaxseeds
-
Sunflower seeds
Pumpkin seeds are particularly magnesium-rich and can be added to oatmeal, yogurt or salads without changing an entire meal.
Nuts and nut butters
Nuts provide magnesium along with protein, fibre and unsaturated fats.
Options include:
-
Almonds
-
Cashews
-
Peanuts
-
Peanut butter
-
Brazil nuts
Portion size still matters because nuts are energy-dense. A small handful is often enough to add useful nutrition to a snack or meal.
Leafy green vegetables
Magnesium sits at the centre of the chlorophyll molecule, which is one reason green vegetables can be useful dietary sources (NIH Office of Dietary Supplements).
Consider adding:
-
Spinach
-
Swiss chard
-
Collard greens
-
Kale
Cooked spinach generally provides more magnesium per measured cup than raw spinach because cooking reduces its volume, making it easier to eat a larger amount.
Beans and legumes
Beans and legumes provide magnesium, fibre, complex carbohydrates and plant-based protein.
Examples include:
-
Black beans
-
Kidney beans
-
Chickpeas
-
Lentils
-
Edamame
They can be added to soups, salads, grain bowls, wraps and pasta dishes.
Whole grains
Refining grains removes parts of the grain that contain magnesium. Whole-grain foods therefore tend to provide more magnesium than their refined equivalents (NIH Office of Dietary Supplements).
Options include:
-
Brown rice
-
Quinoa
-
Oats
-
Whole-wheat bread
-
Whole-grain pasta
Replacing white rice or refined bread with a whole-grain alternative is one of the simplest ways to increase magnesium intake without adding another food to the day.
Other sources
Additional foods that contribute magnesium include:
-
Avocado
-
Dark chocolate
-
Yogurt
-
Milk
-
Bananas
-
Salmon
-
Mackerel
These foods vary considerably in how much magnesium they provide. Seeds, nuts, legumes and cooked leafy greens are generally more concentrated sources than fruit, dairy or fish.
Is dark chocolate helpful or a migraine trigger?
Dark chocolate contains magnesium, but that does not automatically make it a migraine-prevention food.
Some people identify chocolate as a personal migraine trigger. For others, a craving for chocolate may appear during the early phase of an attack, creating the impression that the chocolate caused an attack that had already begun.
You do not need to avoid chocolate simply because you live with migraine. Pay attention to your own pattern and consider tracking it in a headache diary before eliminating a food unnecessarily.
If chocolate repeatedly appears before attacks, look at timing, quantity and surrounding factors such as sleep, stress, missed meals and hormonal changes.
How can you add more magnesium to your diet?
A magnesium-rich diet does not need to be complicated. Small substitutions made consistently are usually more realistic than trying to redesign every meal.
You could:
-
Add pumpkin seeds or almonds to oatmeal, yogurt or salads.
-
Replace white rice with brown rice or quinoa.
-
Blend spinach into a smoothie or add it to eggs, pasta and soups.
-
Choose whole-grain bread instead of white bread.
-
Add black beans or chickpeas to salads and grain bowls.
-
Use peanut or almond butter as part of a snack.
-
Keep lentils in regular rotation for soups, stews and curries.
-
Combine several modest sources instead of relying on one food.
For example, oatmeal with chia seeds and peanut butter will generally contribute more magnesium than any one of those foods alone.
Can food provide enough magnesium for migraine prevention?
Food can help you meet your daily nutritional requirements, but dietary intake cannot be compared directly with the doses used in migraine-prevention studies.
Adult magnesium requirements vary by age and sex but generally fall between 310 and 420 mg per day. These recommendations refer to the total amount needed for nutrition—not a therapeutic dose for migraine prevention (NIH Office of Dietary Supplements).
Migraine trials have commonly evaluated supplemental magnesium in ranges of approximately 300 to 600 mg per day, depending on the magnesium form and how researchers reported the dose. A summary of existing guidelines similarly describes doses within this general range, with magnesium citrate among the commonly discussed forms (Rajapakse and Pringsheim, 2016).
Study results cannot be applied to food intake as though the two were interchangeable. There is currently no established food-only magnesium dose for migraine prevention.
This means someone can eat a nutritious, magnesium-rich diet and still have a reasonable discussion with their clinician about whether a supplement is appropriate.
Is magnesium from food better absorbed?
Magnesium absorption varies with the amount consumed, the food or supplement involved and the body’s existing magnesium status. The body generally absorbs a smaller percentage as the amount consumed at one time increases.
It is therefore difficult to label one magnesium-rich food as the “most bioavailable” choice for migraine. A varied diet containing several magnesium sources is more useful than choosing foods based on a single absorption claim.
Supplement forms also differ. The NIH reports that forms such as magnesium citrate, chloride, lactate and aspartate tend to be absorbed more completely than magnesium oxide (NIH Office of Dietary Supplements). However, better fractional absorption does not automatically prove better migraine-prevention results.
When considering a supplement, the elemental magnesium amount, clinical evidence, digestive tolerance and ability to take it consistently all matter.
When might a magnesium supplement be considered?
A supplement may be worth discussing when someone is looking for an evidence-supported preventive option or is unlikely to obtain the studied amount through food alone.
Magnesium citrate and magnesium oxide are among the forms that have been evaluated in migraine research. Magnesium glycinate is also commonly used, particularly when digestive tolerance is a concern, but it has not been proven superior for migraine prevention.
Supplement labels can be confusing. The important number is the amount of elemental magnesium, not the total weight of the magnesium compound.
For a deeper explanation, read our guides to [magnesium for migraines] and [magnesium glycinate for migraines].
What are the side effects of magnesium supplements?
Magnesium obtained naturally from food is considered safe for most people. The body can generally regulate magnesium obtained through normal dietary intake.
Supplemental magnesium is more likely to cause:
-
Loose stools
-
Diarrhea
-
Abdominal cramping
-
Nausea
Gastrointestinal side effects become more likely as the supplemental dose increases. The form of magnesium and whether the dose is divided throughout the day may also affect tolerability (NIH Office of Dietary Supplements).
People with impaired kidney function should not start a magnesium supplement without medical guidance because the kidneys are responsible for clearing excess magnesium. The VA/DoD guideline specifically notes kidney disease as an important safety consideration when using magnesium for headache prevention (VA/DoD Clinical Practice Guideline for the Management of Headache, 2023).
Magnesium supplements can also interfere with the absorption of certain medications, including some antibiotics and bisphosphonates. Speak with a physician or pharmacist if you take regular medication or have a chronic health condition.
How long does magnesium take to assess?
Magnesium is used as a preventive strategy, not as a treatment intended to stop an attack immediately.
Preventive treatments usually need to be taken consistently for an adequate period before their effect can be judged. For magnesium, this often means allowing at least two to three months at an appropriate dose, provided it is tolerated and used under suitable clinical guidance.
During that period, a headache diary can help you track:
-
Monthly migraine days
-
Attack severity
-
Duration
-
Medication use
-
Side effects
-
Ability to function
Without a baseline, it can be difficult to tell whether a preventive strategy is meaningfully changing your migraine pattern.
Where does 3graine fit?
A magnesium-rich diet is an excellent nutritional foundation, but food and preventive supplements serve different purposes.
3graine combines three ingredients commonly used for migraine prevention—magnesium, riboflavin and CoQ10—in transparent daily amounts. Three capsules provide approximately 300 mg of elemental magnesium alongside 400 mg of riboflavin and 200 mg of CoQ10.
These ingredients and their place in migraine guidelines are discussed in the clinical literature, although the strength of evidence is not identical for every ingredient (Rajapakse and Pringsheim, 2016).
3graine is intended to simplify a three-ingredient routine for people who have discussed these options with their healthcare provider. It does not replace a balanced diet, medical assessment or individualized migraine treatment.
As with any preventive approach, not every person will respond in the same way. Consistency and an adequate trial are important when evaluating whether it is helping.
Frequently asked questions
What foods have the most magnesium?
Pumpkin seeds, chia seeds, almonds, cashews, cooked spinach, black beans and whole grains are among the better dietary sources of magnesium (NIH Office of Dietary Supplements).
Can magnesium-rich foods prevent migraines?
Magnesium-rich foods support adequate magnesium intake, and observational research has found an association between higher dietary magnesium intake and lower odds of migraine or severe headache. However, this does not prove that magnesium-rich foods prevent attacks. Most clinical migraine research has evaluated magnesium supplements at defined doses (Slavin et al., 2021).
What is the best magnesium-rich food for migraine?
There is no single best food for migraine. Seeds, nuts, leafy greens, legumes and whole grains can all contribute. The best choices are foods you tolerate and can eat consistently as part of a balanced diet.
How much magnesium should I get from food?
Adult nutritional requirements generally range from 310 to 420 mg per day, depending on age and sex. This is a nutritional target, not a migraine-treatment dose (NIH Office of Dietary Supplements).
Is a banana high in magnesium?
Bananas contain some magnesium, but they are not among the most concentrated sources. Seeds, nuts, legumes and cooked leafy greens provide considerably more magnesium per typical serving.
Do I still need a supplement if I eat magnesium-rich foods?
Not necessarily. The decision depends on your diet, health, migraine pattern and treatment plan. Because migraine trials have generally studied supplements rather than food alone, speak with a clinician or pharmacist before deciding whether supplementation is appropriate.
How much magnesium is in 3graine?
The recommended daily serving of three capsules provides approximately 300 mg of elemental magnesium. It also contains 400 mg of riboflavin and 200 mg of CoQ10.
The takeaway
Magnesium-rich foods are a safe and affordable way for most people to improve the nutritional quality of their diet. Seeds, nuts, leafy greens, beans and whole grains are among the most useful sources.
Observational research has found a relationship between greater dietary magnesium intake and lower odds of migraine or severe headache, but it cannot prove that increasing magnesium through food will prevent attacks (Slavin et al., 2021).
Magnesium supplements have more direct evidence supporting their use in migraine prevention and are included in several clinical guidelines (Rajapakse and Pringsheim, 2016; VA/DoD Clinical Practice Guideline, 2023). That evidence should not be confused with proof that a particular high-magnesium food or diet can prevent migraine attacks on its own.
Think of food as the nutritional foundation. If you are considering a magnesium supplement, look at the elemental dose, tolerability and evidence, and discuss how it fits into your broader migraine-prevention plan with a healthcare professional.
This article is for general educational purposes and is not a substitute for personalized medical advice, diagnosis or treatment.