What's the science behind taking magnesium for headaches?

An asian woman holds her head with one hand, eyes closed and looks like she is in pain.
(Image credit: Peter Dazeley)

Magnesium is a vital nutrient that plays a part in more than 300 of the body’s processes, but did you know that you can take magnesium for headaches? Due to the role magnesium plays in muscle contraction and relaxation, it can be effective for reducing tension headaches and migraines – these ailments can also become worse if you don’t have enough magnesium in your body. 

Magnesium is also a part of our stress response system, so a reduced magnesium load in our bones (where we store magnesium once it’s in the body) can mean that we are less equipped to deal with stress, which can result in headaches. 

If you’re looking for information about the best magnesium supplement and how it may help to keep headaches in check, read on. It is also worth ensuring that you’re consuming enough dietary magnesium, so we’ve put together a list of the best magnesium rich foods to make it easier for you to get enough of this essential mineral. 

What causes headaches?

Headaches can be indicative of several underlying health conditions, so if you experience regular headaches or chronic head pain, it’s worth going to get checked out by your medical provider. 

A older black woman holds the top of her nose with her fingers. She looks like she is in pain.


Dr Deborah Lee, a medical doctor and writer for Dr Fox Online Pharmacy, says that there are several types of headache with various underlying causes:

  • Tension headaches
  • Cluster headaches
  • Migraines
  • Hormone headaches, such as headaches on the contraceptive pill or with HRT
  • Painkiller headaches, due to withdrawal after taking too many
  • Hangovers after excess alcohol
  • Headaches due to head injury
  • Viral infections, such as colds and flu
  • Sinusitis
  • Sleep apnoea 

A review in International Scholarly Research Notices indicates that headaches are the 14th most common reason that people go to their family doctor in the US. Around 1.5% of visits to a general practitioner are for headaches and most people reported that they won’t go to the doctor for a headache. Another report in the Headache journal estimates that chronic daily headaches affect approximately 4% of the population.

What’s the link between magnesium and headaches?

Roxana Ehsani, a registered dietitian nutritionist and national media spokesperson for the Academy of Nutrition and Dietetics, explains that magnesium deficiency can cause many symptoms, including headaches. 

“Most people actually aren’t consuming enough magnesium per day and some people may be more susceptible to losses than others,” she says. “For example, athletes actually lose more than just sodium in their sweat. They also lose some magnesium as well and may have lower magnesium levels than others.

Roxana Ehsani registered dietitian nutritionist
Roxana Ehsani, MS, RD, CSSD, LDN

Roxana Ehsani is a Board-Certified Specialist in Sports Dietetics and a National Media Spokesperson for the Academy of Nutrition and Dietetics. She holds a Bachelors of Science in Human Nutrition, Foods and Exercise from Virginia Tech and a Masters of Science in Clinical Nutrition and Dietetics from the University of Pittsburgh and completed her dietetic internship at the University of Pittsburgh Medical Center. 

“Studies have also found that people who have low levels of magnesium are more likely to suffer from migraines and supplementing with magnesium may help prevent migraine attacks from occurring as frequently. You could also try to add more magnesium rich foods into your diet such as dark leafy greens, whole grains, legumes, nuts and seeds like almonds, pumpkin seeds, and even dark chocolate.”

Almond seeds

(Image credit: Svetlana Lukienko | Shutterstock

A 2020 review in the Nutrients journal indicates that magnesium deficiency can be responsible for tension headaches and migraines, which make up 90% of the headache cases dealt with in general practice. The review states that magnesium supplementation may offer an alternative to painkillers in vulnerable populations, such as children and the elderly, who may struggle with side effects from traditional headache medications. 

“Magnesium plays an important role in muscle contractility,” adds Lee. “Hence it makes sense that it could be involved in the development of tension headaches. Around 70% of those with tension headaches have symptoms of muscular tension and tightness. Tension headaches appear to be associated with scalp tension more than other types of headaches. Muscle tension, cramps and strains are all more common when magnesium is deficient, and magnesium supplements can help improve headaches and reduce muscular tension.”

Another review in the journal Magnesium in the Central Nervous System found that magnesium deficiency can promote several major elements that cause migraines to develop. The review states that magnesium is a safe and well-tolerated option for treating migraines and other types of headache and can be used as an acute treatment option if necessary.

A guy with a headache from a hangover.

(Image credit: Shutterstock)

“Those suffering from migraines have lower levels of magnesium in the blood and cerebrospinal fluid than those without migraines,” says Lee. “In a further study, those with migraines with and without aura, and tension headaches, were found to have significantly reduced blood and salivary magnesium levels compared with a group of healthy controls.

“In an Internal Clinical Psychopharmacology review, investigators also discovered when they compared magnesium levels in those with migraine and those without, that low magnesium levels increased the odds of migraine episodes by a factor of 35.”

Are magnesium supplements safe?

Magnesium supplements are safe for most people, although high doses may cause diarrhea for some individuals. Too much dietary magnesium tends not to be a problem for healthy people, as any excess will be processed by the kidneys and be excreted in urine. 

If you are pregnant, breastfeeding, taking any medications or suffer from any medical conditions, always consult your doctor before taking magnesium supplements: different people will have different needs for this mineral.

Seeds and nuts on a table

(Image credit: John Lawson)

A review in Open Heart explains that a lot of cases of magnesium deficiency go undiagnosed, because 99% of our magnesium is kept within our cells. It also states that the majority of the population is at risk of a magnesium deficiency due to our reliance on refined and processed foods, prevalence of chronic disease and a reduction in the amount of magnesium in our food crops. With this in mind, taking a magnesium supplement may help populations reduce the occurrence of magnesium deficiency.

Lee encourages those considering supplementation to consult their doctor first, particularly if they are on other medication. “It’s always better to obtain vitamins and minerals from eating a well balanced diet than relying on supplements,” she says. “Your body is designed to absorb natural vitamins and minerals from the gut and may well not absorb supplements nearly so well. 

“If you suffer from any chronic medical conditions or take any regular medication, always check with your doctor before starting magnesium supplements. They interact with some types of medication, such as bisphosphonates, tetracyclines, quinolones, furosemide and proton pump inhibitors.”

This article is for informational purposes only and is not meant to offer medical advice.

Lou Mudge
Health Writer

Lou Mudge is a health writer based in Bath, United Kingdom for Future PLC. She holds an undergraduate degree in creative writing from Bath Spa University, and her work has appeared in Live Science, Tom's Guide, Fit & Well, Coach, T3, and Tech Radar, among others. She regularly writes about health and fitness-related topics such as air quality, gut health, diet and nutrition and the impacts these things have on our lives. 

She has worked for the University of Bath on a chemistry research project and produced a short book in collaboration with the department of education at Bath Spa University.