What magnesium does in your body
Magnesium is a mineral your cells use to produce energy, build proteins, and regulate electrical signals in your nerves and muscles. It sits at the center of hundreds of enzyme reactions—the chemical processes that keep you alive. Without enough magnesium, your body cannot convert food into usable energy or contract muscles properly.
Your bones hold about 60% of your body's magnesium. The rest circulates in your blood and lives inside your cells, where it activates enzymes that control everything from DNA repair to blood sugar regulation. When magnesium levels drop below what your cells need, symptoms often appear first in muscles (cramps, weakness) and nerves (fatigue, irritability).
Key Takeaways
- Magnesium enables hundreds of enzyme reactions that produce energy, build proteins, and regulate muscle and nerve function.
- Low magnesium is linked to muscle cramps, migraines, sleep problems, and high blood pressure in observational studies and small trials.
- Leafy greens, nuts, seeds, and whole grains are reliable food sources; most people in Western countries consume less than recommended amounts.
- Magnesium supplements show promise for specific conditions like migraines and restless leg syndrome, but evidence is stronger for some uses than others.
- High doses of magnesium can cause diarrhea; the safe upper limit is 350 mg per day from supplements alone.
Muscle function and cramps
Magnesium controls how muscles contract and relax. When a muscle fiber receives a signal, magnesium helps calcium enter the cell to trigger contraction. When the signal stops, magnesium helps calcium leave so the muscle can relax. Without enough magnesium, muscles stay partially contracted or spasm unpredictably.
People who report frequent leg cramps often have low magnesium, and small trials show that magnesium supplements reduce cramp frequency in some individuals. A 2017 trial in the Journal of the American Board of Family Medicine found that magnesium reduced nighttime leg cramps in older adults, though the effect was modest. Athletes and people taking certain medications (like diuretics) lose magnesium through sweat and urine and may benefit most from supplementation.
Migraine frequency and severity
People with migraines often have lower magnesium levels than those without migraines, and magnesium plays a role in blood vessel function and nerve signaling—both involved in migraine onset. Several trials have tested whether raising magnesium levels reduces how often migraines occur.
A 2012 review in the journal Headache found that magnesium supplementation reduced migraine frequency by about 40% in people with low baseline magnesium. The effect was strongest in people who had documented magnesium deficiency before treatment began. Doses used in these trials ranged from 400 to 600 mg daily, and benefits took 8 to 12 weeks to appear. The evidence is stronger for prevention than for stopping a migraine once it starts.
Sleep quality and restlessness
Magnesium influences the nervous system's ability to shift into rest mode. It activates receptors that calm neural activity and helps regulate melatonin, the hormone that signals sleep time. Low magnesium is associated with insomnia and restless leg syndrome—a condition where legs twitch involuntarily at night.
A 2012 trial published in Sleep found that magnesium supplementation improved sleep quality and reduced the time it took to fall asleep in older adults with insomnia. A separate 2014 trial in Sleep Medicine Reviews showed magnesium reduced symptoms of restless leg syndrome. These studies used doses between 200 and 400 mg taken in the evening. The effect is modest but consistent across multiple small trials, though larger studies are still needed.
Blood pressure and heart rhythm
Magnesium helps blood vessels relax and regulates the electrical signals that control heartbeat. Observational studies show that people who consume more magnesium tend to have lower blood pressure than those who consume less. A 2016 review of 34 trials found that magnesium supplementation lowered systolic blood pressure (the top number) by an average of 2 to 3 mmHg—a small but measurable effect.
The effect was stronger in people with high blood pressure at the start of the study. Magnesium also appears to reduce irregular heartbeat in some people, though this effect is less well-studied. These benefits emerged at doses of 300 to 500 mg daily over 8 to 26 weeks. Magnesium is not a replacement for blood pressure medication, but it may support other treatments.
Bone strength and fracture risk
Your skeleton stores magnesium and uses it to build and maintain bone structure. Low magnesium is linked to lower bone density and higher fracture risk in observational studies. Magnesium works alongside calcium and vitamin D—all three are needed for bone formation.
A 2013 study in Nutrients found that people with higher magnesium intake had stronger bones than those with lower intake, independent of calcium intake. However, most evidence comes from observational data rather than trials where people are randomly assigned to magnesium or placebo. Magnesium alone cannot prevent osteoporosis; calcium, vitamin D, and weight-bearing exercise are equally important.
Food sources and how much you need
The recommended daily intake is 310 to 320 mg for adult women and 400 to 420 mg for adult men, depending on age. Leafy greens (spinach, kale, Swiss chard) contain the most magnesium per serving—one cup of cooked spinach has about 157 mg. Nuts and seeds (almonds, pumpkin seeds, sunflower seeds) are also rich sources, as are whole grains, legumes, and dark chocolate.
Most people in Western countries consume less than the recommended amount, though true deficiency is rare because your kidneys conserve magnesium when intake is low. Certain medications (diuretics, some antibiotics, bisphosphonates for bone health) and digestive conditions (Crohn's disease, celiac disease) increase magnesium loss. If you fall into these categories, a healthcare provider can measure your magnesium level and recommend whether supplementation makes sense.
Supplement forms and safety
Magnesium supplements come in several forms: magnesium citrate, glycinate, malate, and oxide are common. Citrate and glycinate are absorbed well and less likely to cause loose stools. Magnesium oxide is cheaper but less absorbable and more likely to cause diarrhea—it is often used as a laxative.
The safe upper limit from supplements is 350 mg per day for adults, though food sources have no upper limit. Doses above this can cause diarrhea, nausea, and muscle weakness. People with kidney disease should not take magnesium supplements without medical supervision because their kidneys cannot excrete excess magnesium. Magnesium can interact with certain antibiotics and bisphosphonate medications—take supplements at least two hours apart from these drugs.
Frequently Asked Questions
Can magnesium help with anxiety?
Magnesium plays a role in nervous system regulation, and some small trials show it reduces anxiety symptoms. However, the evidence is weaker than for migraines or sleep. If you have an anxiety disorder, magnesium is not a substitute for therapy or medication, but it may be a useful addition alongside other treatments.
Is it better to get magnesium from food or supplements?
Food sources are preferable because they provide magnesium alongside other nutrients and fiber, and you cannot overdose from food. Supplements are useful if you have documented low magnesium, take medications that deplete it, or have a digestive condition that reduces absorption. A healthcare provider can help you decide.
How long does it take to feel the effects of magnesium?
Effects vary by use. Sleep quality may improve within days to weeks. Migraine prevention typically takes 8 to 12 weeks. Muscle cramps may improve within weeks. Blood pressure changes take 8 to 26 weeks. Consistency matters—benefits appear only if you take it regularly.
Can I take magnesium with other supplements?
Magnesium can reduce absorption of certain medications and supplements, including some antibiotics, bisphosphonates, and iron. Space magnesium supplements at least two hours apart from these. Calcium and magnesium can compete for absorption, so take them at different times of day if you supplement both.
What does a magnesium deficiency feel like?
Early signs include muscle cramps, fatigue, irritability, and difficulty sleeping. Severe deficiency (rare) causes irregular heartbeat, numbness, and personality changes. A blood test can measure magnesium, though it reflects only circulating magnesium, not what is stored in cells. If you suspect deficiency, ask a healthcare provider for testing.