Skip to main content
Headaches

Does Magnesium Help with Headaches?

Anne Jacobson, MD, MPHKatie E. Golden, MD
Written by Anne Jacobson, MD, MPH | Reviewed by Katie E. Golden, MD
Published on December 1, 2026

Key takeaways:

  • Magnesium for headaches works best when you take it every day to prevent a headache. It’s less helpful once a headache has already started. 

  • Most research on magnesium for headaches focuses on migraine headaches. Most experts recommend 400 mg to 600 mg per day for migraine prevention.

  • Magnesium supplements are safe for most people. But some forms are more likely to cause side effects, like bloating and diarrhea. People with kidney problems should talk to their healthcare team to take magnesium safely.

Frequent headaches can be debilitating. And the goal of treatment isn’t just to find a way to ease the pain once a headache starts. It’s also to prevent headaches from starting in the first place.

With migraines, in particular, prescription medications can help both treat and prevent headaches. But these treatments don’t work well enough for everyone. So some people look for relief from vitamins, supplements, and natural remedies. 

Magnesium is a mineral found in many foods and supplements. It’s also one of the most common supplements used for headaches. So let’s take a look at what the research says about using magnesium for the treatment and prevention of headaches.

Can you take magnesium for headaches?

Magnesium seems to be most effective for preventing migraine headaches, even in people who have normal magnesium levels on a blood test. That’s because most of your body’s magnesium isn’t stored in your blood. So, a blood test doesn’t necessarily reflect how much magnesium there is in your body.

Taking magnesium doesn’t help everyone with migraine headaches. Still, most migraine experts believe a magnesium supplement is worth a try. This is especially true if you take prescription medications but still get a lot of headaches.

Magnesium supplements work best for prevention, not treatment. This means you need to take them every day, not just when you feel a headache coming on. Research also suggests that magnesium may work best for people who get: 

  • Migraines with aura, which are migraines that are preceded by symptoms like changes in vision or tingling. 

  • Hormonal migraines, which are migraines that happen around the time of your menstrual period.

There isn’t as much evidence for magnesium for other kinds of headaches. But magnesium is a mineral that helps muscles contract and relax. So, magnesium supplements may also help prevent tension headaches. 

Oral magnesium doesn’t prevent cluster headaches. But an intra venous (IV) infusion of magnesium might help some people when they’re having this type of severe headache.

How does magnesium work for headaches?

Magnesium may help to stop the wave of changes in brain cells and blood vessels that happen before a migraine. It does this by relaxing blood vessels and balancing brain chemicals that increase pain signals. It also seems to decrease muscle tension, which can happen with all kinds of headaches.

Many people don’t get enough magnesium in their diet. Low magnesium in the body, even with a normal blood test, could lead to more frequent headaches. This is especially true for people who experience migraines. 

What kind of magnesium is best for headaches?

If you look at the supplements in your local pharmacy, you’ll see many different types of magnesium. There aren’t any studies that do a head-to-head comparison of what type of magnesium works best for headaches. To choose the best one for you, it helps to consider factors like cost and side effects.

Formulation

Evidence

Cost

Side Effects

Magnesium citrate

One of the most studied forms for migraine prevention

Inexpensive

Can have a laxative effect at higher doses and may cause stomach upset or diarrhea

Magnesium oxide

Shown to help prevent migraines in studies

Inexpensive

Can cause stomach upset or diarrhea

Magnesium glycinate and threonate

Less research is available on these forms for headache prevention, but they’re thought to work just as well

Tend to be more expensive

These are the best absorbed forms of magnesium, so they may be less likely to cause stomach-related side effects

Combination forms (magnesium plus other supplements, like riboflavin and CoQ10)

There’s evidence that these other supplements may help migraine prevention, but it’s unknown if these combinations work better

Combining with other supplements may help balance cost

Vary depending on the ingredients

Most experts recommend starting with a daily dose of 400 mg to 600 mg. 

What are the side effects?

The most common side effects of magnesium supplements affect the gastrointestinal (GI) system. These may include:

  • Bloating

  • Diarrhea

  • Nausea

  • Abdominal cramps

Magnesium citrate and magnesium oxide are also used to treat occasional constipation. The recommended dose to prevent headaches is lower than the dose used to treat constipation. Still, some people could still experience side effects.

If stomach upset or diarrhea are causing trouble, there are some things you can try:

  • Start with 400 mg a day, split into two separate doses. 

  • Increase the dose only if you’re not getting relief after taking 400 mg a day for 4 to 6 weeks. Talk to your healthcare team before increasing your dose. 

  • Take magnesium supplements with food.

  • Try a different form. Some types, like magnesium glycinate, may cause fewer GI problems. 

Serious side effects of magnesium are uncommon but could include:

  • Dehydration

  • Muscle weakness

  • Heart rhythm problems

  • Shallow breathing

Serious side effects are more of a risk for people whose kidneys don’t work well or in those who take a very high dose without consulting their healthcare team.

Does magnesium interact with medications or supplements?

Most people can safely take magnesium supplements with other medications. But your healthcare team may need to adjust the dose or recommend taking the magnesium several hours apart from certain medications. 

Medications that may interact with magnesium supplements include:

  • Bisphosphonates (like alendronate)

  • Some antibiotics (like doxycycline, ciprofloxacin, and levofloxacin)

  • Diuretics (water pills)

  • Proton pump inhibitors or PPIs (like pantoprazole and omeprazole)

  • Some human immunodeficiency virus (HIV) medications

  • Calcium and zinc supplements

  • Gabapentin

This isn’t a full list of possible interactions. Talk to your healthcare team about all the medications you take, including vitamins, supplements, and herbal products.

Frequently asked questions

There are many different triggers for migraines. These include certain foods, changes in sleep, hormone fluctuations, stress, and more. Magnesium plays a role in how cells and chemicals in your brain work. So, having low magnesium may make you more likely to get a headache when exposed to a trigger. 

Many people with mild magnesium deficiency don’t have symptoms. And a blood test won’t always show whether your body lacks magnesium. Some symptoms of very low magnesium include:

  • Muscle tremors, cramps, and twitches

  • Heart palpitations

  • Feeling weak and tired

  • Numbness

  • Mood changes

  • Confusion

For some people, adding more magnesium to their diet may be enough to help prevent headaches. Others may also need a supplement to notice a difference. Either way, eating a balanced diet is a great place to start for migraine management. Some good food sources of magnesium include:

  • Beans, peas, and lentils

  • Nuts and seeds

  • Leafy green vegetables

  • Whole grains

  • Soybeans and tofu

The bottom line

There’s a good amount of research to suggest that magnesium can help prevent migraine headaches. Taking magnesium alone may not prevent all headaches. But getting enough magnesium through foods and supplements may decrease the number of headaches you get. This may be especially helpful for people who have migraines with aura or migraines related to hormone changes. Magnesium supplements are safe for most people. But there are a few different types to choose from. Talk with your healthcare team about the right form and dose for you.

why trust our exports reliability shield

Why trust our experts?

Anne Jacobson, MD, MPH has been a board-certified physician since 1999. She was a full-scope family physician (inpatient, outpatient, obstetrics, and office procedures) in the Cook County Ambulatory Health Network for 15 years.
Katie E. Golden, MD, is a board-certified emergency medicine physician and a medical editor at GoodRx.

References

Coppola, G., et al. (2025). Hallmarks of primary headache: Part 3 – cluster headache. The Journal of Headache and Pain.

Dominguez, L. J., et al. (2025). Magnesium and migraine. Nutrients.

Mauskop, A., et al. (2012). Why all migraine patients should be treated with magnesium. Journal of Neural Transmission.

Orr, S. L., et al. (2015). Diet and nutraceutical interventions for headache management: A review of the evidence. International Headache Society. 

Pan, L. H., et al. (2025). Hallmarks of primary headache: Part 2– Tension-type headache. The Journal of Headache and Pain. 

Tepper, D. (2021). Magnesium and migraine. American Migraine Foundation.

Yablon, L. A., et al. (2011). Magnesium in the central nervous system. University of Adelaide Press.

GoodRx Health has strict sourcing policies and relies on primary sources such as medical organizations, governmental agencies, academic institutions, and peer-reviewed scientific journals. Learn more about how we ensure our content is accurate, thorough, and unbiased by reading our editorial guidelines.

Was this page helpful?

Latest articles