Nutrition

Magnesium for Sleep, Muscle Cramps and Exercise: What the Evidence Shows

Does magnesium help sleep, leg cramps or workouts? What trials and the Cochrane review show, the RDA, the 350 mg supplement limit, food sources and safety.

Magnesium is an essential mineral, but as a supplement it does less for sleep, muscle cramps and exercise than its reputation suggests. For sleep, small trials show a modest benefit at best: older adults with insomnia fell asleep about 17 minutes faster in a pooled analysis of three low-quality trials, and a 2025 trial in adults with poor sleep found a small improvement in insomnia scores. For leg cramps, a Cochrane review concluded that magnesium is unlikely to help older adults with night cramps, and it found no trials at all for exercise-related cramps. For athletes who already get enough, a meta-analysis found no gain in strength or power.

Plenty of Americans still fall short on magnesium from food, and fixing that through diet is a sound goal. This guide covers what the research actually shows, how much you need, the best food sources, how the supplement forms differ, the safe upper limit for supplements, and who should talk to a clinician before taking one.

The evidence at a glance

What controlled research shows for common magnesium claims
ClaimBest evidenceWhat it found
Helps you fall asleepMeta-analysis of 3 trials, 151 older adults with insomnia (2021)Fell asleep about 17 minutes faster than with placebo; evidence rated low to very low quality
Improves poor sleep in younger adultsOne randomized trial, 155 adults aged 18–65 (2025)Small extra improvement in insomnia score after 4 weeks; effect size described as small
Prevents night leg crampsCochrane review, 11 trials (2020)No meaningful benefit for older adults; pregnancy results conflicting
Prevents exercise crampsSame Cochrane reviewNo randomized trials found
Boosts strength or powerMeta-analysis of 14 trials (2017)No significant gains in athletes or active people; possible benefit in people likely to be low
Reduces muscle sorenessSystematic review of 4 studies (2024)Positive findings, but too few small studies to be confident

Does magnesium help you sleep?

Magnesium is involved in nerve function and muscle contraction, so the idea that it might calm the body before bed is plausible. The question is whether taking a supplement makes a difference you can notice. Here is what the controlled trials show.

Older adults with insomnia

A 2021 systematic review and meta-analysis by Mah and Pitre found only three randomized trials comparing oral magnesium with placebo in older adults with insomnia, with 151 people in total. In the pooled analysis, people taking magnesium fell asleep 17.36 minutes faster than those taking placebo. Total sleep time rose by about 16 minutes, but that difference was not statistically significant.

The authors were blunt about the limits. All three trials were at moderate to high risk of bias, and the evidence was rated low to very low quality. They concluded that the research is "substandard for physicians to make well-informed recommendations," while noting that magnesium is cheap and widely available.

Adults with poor sleep: the 2025 magnesium bisglycinate trial

The largest recent trial tested magnesium bisglycinate, the form often sold as "magnesium glycinate." Schuster and colleagues randomly assigned 155 adults aged 18 to 65 in Germany who reported poor sleep to take either 250 mg of elemental magnesium a day or a placebo for four weeks. Participants took the capsules 30 to 60 minutes before bed.

  • Insomnia Severity Index scores fell by 3.9 points with magnesium and 2.3 points with placebo, a difference of 1.6 points on a 28-point scale.
  • The authors described the effect as small and the benefit as modest. On average, the magnesium group's scores at week 4 were still in the mild, "subthreshold" insomnia range.
  • No other sleep or mood measure differed between the groups, and all outcomes were self-reported. There was no sleep lab or wearable data.
  • The daily dose also contained 1,523 mg of glycine, so the trial cannot fully separate the effect of the magnesium from that of the glycine.

An exploratory analysis hinted that people who ate less magnesium-rich food improved more, but the diet question was not validated. That idea still needs testing.

What this means for you

A 2023 systematic review in Biological Trace Element Research sums it up. Observational studies link better magnesium status with better sleep, but randomized trials of supplements show "an uncertain association." Magnesium might nudge sleep a little, especially if your diet is low in it. It is not a substitute for the basics: a consistent schedule, a dark and cool room, and less caffeine late in the day. Our guide on how to sleep better at night naturally covers those habits, and if you train in the afternoon, see how pre-workout caffeine affects your sleep. For chronic insomnia, the 2025 trial's authors note that cognitive behavioral therapy for insomnia (CBT-I) is considered the most effective treatment.

Does magnesium help muscle cramps?

Muscle cramps are one of the most common reasons people buy magnesium. Low magnesium can cause cramps, but that is not the same as supplements preventing everyday cramps in people who are not deficient. The best summary of the evidence is a 2020 Cochrane review by Garrison and colleagues, which included 11 randomized trials with 735 participants.

Night leg cramps in older adults

For cramps with no obvious cause, mostly nighttime leg cramps in people with an average age in their 60s, magnesium did no better than placebo. After four weeks, the number of cramps per week differed by only 0.18 (moderate-certainty evidence). The share of people whose cramps dropped by at least 25% was the same in both groups (high-certainty evidence). Cramp intensity and duration did not differ either. The reviewers concluded it is "unlikely that magnesium supplementation provides clinically meaningful cramp prophylaxis to older adults experiencing skeletal muscle cramps."

Leg cramps in pregnancy

Five trials looked at pregnancy-related leg cramps, but all five were judged at high risk of bias and could not be combined. One found no benefit, one found a benefit, and one had inconsistent results. The review calls this evidence conflicting. Pregnant people should ask their obstetric clinician before taking any supplement.

Cramps during exercise

The review found no randomized trials of magnesium for exercise-associated muscle cramps. So there is no controlled evidence either way for the runner who cramps late in a marathon or the player who cramps in overtime. Magnesium may still be worth trying for some people, but any claim that it prevents exercise cramps goes beyond the evidence.

A marathon runner in a white shirt and race bib bends over a concrete highway barrier to deal with a leg cramp as other runners walk past on the road
A runner stops with a leg cramp near mile 21 of the 2009 Marine Corps Marathon. No randomized trials have tested magnesium for exercise cramps. Photo: U.S. Marine Corps, public domain, via Wikimedia Commons.

Side effects in the cramp trials were mostly digestive. Diarrhea and other stomach complaints affected 11% to 37% of people taking oral magnesium, compared with 10% to 14% of people on placebo.

Does magnesium improve exercise performance or recovery?

Magnesium helps produce energy and is needed for normal muscle contraction, so a true deficiency can hurt performance. Extra magnesium on top of an adequate intake is a different question.

  • Strength and power: A 2017 meta-analysis of 14 randomized trials (Wang and colleagues) found no significant improvement in peak torque, muscle strength or muscle power. Benefits "were not apparent in athletes and physically active individuals." Any benefit appeared mainly in older adults and people with alcohol dependence, groups more likely to be low in magnesium.
  • Soreness and recovery: A 2024 systematic review (Tarsitano and colleagues) reported less muscle soreness and better recovery with magnesium. However, it included only four studies, so it is a weak basis for buying a recovery supplement. For managing soreness, see our guide on whether to work out when you're sore.

The practical takeaway for active people is to make sure your diet covers the recommended amount, because that is where the evidence for benefit lies. Magnesium is not a proven performance booster.

How much magnesium do you need?

The Recommended Dietary Allowance (RDA) covers magnesium from all sources: food, drinks, supplements and medicines. These figures come from the Food and Nutrition Board, as listed in the NIH Office of Dietary Supplements fact sheet.

Magnesium RDA per day for teens and adults (NIH Office of Dietary Supplements)
AgeMenWomenPregnancyBreastfeeding
14–18 years410 mg360 mg400 mg360 mg
19–30 years400 mg310 mg350 mg310 mg
31–50 years420 mg320 mg360 mg320 mg
51 years and older420 mg320 mg––

For children, the RDA is 80 mg at ages 1 to 3, 130 mg at ages 4 to 8 and 240 mg at ages 9 to 13. The Daily Value (DV) on US food and supplement labels is 420 mg for adults and children 4 and older.

Many Americans fall short. In national survey data from 2013 to 2016, 48% of Americans ate and drank less magnesium than their estimated average requirement. Adolescents and men aged 71 and older were the most likely to have low intakes. Older adults, people with type 2 diabetes, people with gut conditions such as Crohn's or celiac disease, and people with alcohol dependence are also at higher risk of running low, according to NIH.

The upper limit for supplements: 350 mg

The Tolerable Upper Intake Level (UL) for adults and teens 14 and older is 350 mg a day from supplements and medicines. It is 65 mg at ages 1 to 3, 110 mg at ages 4 to 8 and 350 mg at ages 9 to 13. The UL does not include magnesium naturally present in food and drinks. That is why the UL can be lower than the RDA: healthy kidneys clear extra magnesium from food, but large supplemental doses cause diarrhea.

Count everything you take. Some laxatives and antacids contain magnesium, and some multivitamins and "sleep" or "recovery" blends do too.

Best food sources of magnesium

Green leafy vegetables, legumes, nuts, seeds and whole grains are the best sources. In general, foods with fiber tend to contain magnesium, while refining grains strips much of it out. The amounts below come from the NIH fact sheet, which uses USDA FoodData Central data.

Magnesium in common foods (NIH Office of Dietary Supplements, from USDA FoodData Central)
Food and servingMagnesium% Daily Value
Pumpkin seeds, roasted, 1 ounce156 mg37%
Chia seeds, 1 ounce111 mg26%
Almonds, dry roasted, 1 ounce80 mg19%
Spinach, boiled, ½ cup78 mg19%
Cashews, dry roasted, 1 ounce74 mg18%
Peanuts, oil roasted, ¼ cup63 mg15%
Shredded wheat cereal, 2 large biscuits61 mg15%
Soymilk, plain or vanilla, 1 cup61 mg15%
Black beans, cooked, ½ cup60 mg14%
Edamame, shelled, cooked, ½ cup50 mg12%
Peanut butter, smooth, 2 tablespoons49 mg12%
Potato, baked with skin, 3.5 ounces43 mg10%
Brown rice, cooked, ½ cup42 mg10%
Yogurt, plain, low fat, 8 ounces42 mg10%
Banana, 1 medium32 mg8%
White rice, cooked, ½ cup10 mg2%

A day that includes an ounce of pumpkin seeds, half a cup of black beans, a cup of soymilk and a serving of brown rice adds up to about 319 mg, before counting anything else you eat. Tap, mineral and bottled water can add more. NIH says the amount varies widely, from 1 mg to more than 120 mg per liter depending on the source. About 30% to 40% of the magnesium in food is absorbed.

A round metal bowl filled with pale, whole pumpkin seeds in their shells, seen from above on a white surface
Pumpkin seeds top the NIH list of magnesium-rich foods, with 156 mg per roasted ounce. Photo: Christopher Sessums, CC BY-SA 2.0, via Wikimedia Commons.

For more on these foods, see our guides to pumpkin seed nutrition and micronutrients and what they do.

Magnesium glycinate vs citrate vs oxide: does the form matter?

Supplements pair magnesium with another compound, and the Supplement Facts label lists the amount of elemental magnesium, not the weight of the whole compound. Compare products by that number.

  • Absorption: NIH says forms that dissolve well in liquid are absorbed more completely. Small studies found the aspartate, citrate, lactate and chloride forms more bioavailable than magnesium oxide and sulfate.
  • Stomach upset: NIH lists magnesium carbonate, chloride, gluconate and oxide as the forms most often reported to cause diarrhea.
  • Glycinate (bisglycinate): The NIH fact sheet does not rate this form. It is the form used in the 2025 sleep trial above, where it was well tolerated: participants reported 2 adverse events with magnesium and 7 with placebo, and none were serious. We found no head-to-head trial showing that glycinate improves sleep more than other forms, so claims that one form is "best for sleep" go beyond the research.

Better absorption is not automatically better. A form that is absorbed well also puts more magnesium into your bloodstream, which matters if your kidneys do not work well.

Side effects and who should talk to a clinician first

Magnesium from food is not a concern for healthy people. Supplements and medicines are different:

  • Common side effects: High doses from supplements or medicines often cause diarrhea, sometimes with nausea and stomach cramps.
  • Toxicity: Very large doses, usually from laxatives and antacids that provide more than 5,000 mg a day, have caused magnesium toxicity. Symptoms include low blood pressure, nausea, vomiting, facial flushing, muscle weakness, difficulty breathing and irregular heartbeat, and deaths have been reported.
  • Kidney disease: The risk of toxicity rises when kidney function is reduced, because the kidneys are what remove extra magnesium. Don't take magnesium supplements without your doctor's advice if you have kidney disease.

NIH lists these medication interactions. If you take any of these drugs regularly, talk to your doctor or pharmacist before adding magnesium:

Magnesium and medication interactions (NIH Office of Dietary Supplements)
MedicineExamplesWhat NIH says
Oral bisphosphonates (osteoporosis)AlendronateMagnesium can reduce absorption; separate doses by at least 2 hours
Tetracycline and quinolone antibioticsDoxycycline, ciprofloxacin, levofloxacinTake the antibiotic at least 2 hours before or 4 to 6 hours after magnesium
Loop and thiazide diureticsFurosemide, bumetanide, hydrochlorothiazideLong-term use can deplete magnesium
Potassium-sparing diureticsAmiloride, spironolactoneReduce magnesium loss in urine
Proton pump inhibitors (long-term)Esomeprazole, lansoprazoleUse for more than about a year can cause low magnesium; FDA advises clinicians to consider checking levels

Also check with a clinician if you are pregnant or breastfeeding, or if cramps are frequent or severe or come with weakness, swelling or numbness. A supplement won't fix those problems. And if you are thinking about the higher doses sometimes used for migraine prevention, note that they exceed the UL. NIH says that kind of use should be supervised by a health care provider.

If you want to try magnesium: a practical checklist

  1. Start with food. Check your diet against the table above. Seeds, nuts, beans, leafy greens and whole grains are the low-risk way to close a gap.
  2. Stay at or under 350 mg from supplements unless a clinician advises otherwise, and add up every product that contains magnesium.
  3. Read the elemental magnesium amount on the Supplement Facts panel, not the compound weight.
  4. Set realistic expectations. In the best trials, the sleep benefit was modest and showed up over weeks, not overnight. Don't expect it to stop exercise cramps.
  5. Back off if you get diarrhea. It is the most common sign that the dose is too high or the form doesn't suit you.
  6. Check with a clinician or pharmacist first if you have kidney disease, take any of the medicines above, or are pregnant.

FAQ

Is it safe to take magnesium every night?

For most healthy adults, a supplement that keeps total supplemental magnesium at or below 350 mg a day is within the upper limit set for daily use. The 2025 sleep trial gave 250 mg nightly for four weeks without serious side effects. People with kidney disease, or who take the interacting medicines listed above, should ask a clinician first.

Is magnesium glycinate better for sleep than magnesium citrate?

There is no head-to-head evidence to say so. The most recent positive sleep trial used bisglycinate, but it did not compare forms, and its dose included a large amount of glycine. Citrate is among the forms NIH describes as better absorbed than oxide, but no trial has shown that this translates into better sleep.

Should athletes take magnesium?

Athletes should meet the RDA, ideally through food. Trials have not shown that extra magnesium boosts strength or power in active people who already get enough. Heavy training, restrictive diets or medical conditions can change that picture, so talk to a sports dietitian or physician if you think you are low. Standard blood tests don't reliably show total body magnesium, so it is not a simple thing to check.

Why do I get leg cramps at night?

Muscle cramps are common and often linked with older age, pregnancy or exercise. Most have no obvious underlying cause, and the Cochrane review suggests magnesium is unlikely to prevent night cramps in older adults. If cramps are frequent or disrupt your sleep, ask your doctor to look for a cause.

This article is general information, not medical advice. It isn't a substitute for advice from a doctor, pharmacist or other qualified health professional, especially if you have a medical condition, take prescription medicines, or are pregnant.

Sources