Magnesium and Electrolytes for Cramp Prevention

Magnesium and Electrolytes — scientific infographic poster

Magnesium is the most common cramp remedy recommended by primary-care doctors and the one whose evidence is most contested. The 2020 Cochrane review concluded that magnesium probably does not meaningfully reduce idiopathic nocturnal cramps in the general adult population — while for pregnancy-associated cramps it found the trials conflicting — and practitioners report responders among older adults, athletes, and patients on diuretics or proton pump inhibitors. Practitioners explain the disconnect as a measurement problem: serum magnesium is a poor measure of cellular magnesium, the form of magnesium taken matters more than the dose, and the trial populations were mostly already-replete community-dwelling adults. This page maps the physiology of the calcium-magnesium-sodium-potassium quartet that governs muscle relaxation, walks through what is known about the different magnesium forms, and describes the doses and durations used in the trials and in practice.


⚛️ Interactive Visualization Magnesium — the mineral that makes adenosine triphosphate (ATP) work Bare adenosine triphosphate is useless and enzymes reject it. Watch magnesium clamp the phosphates and switch it on, plug the N-methyl-D-aspartate (NMDA) channel, and let a cramping muscle finally let go. Launch →

Table of Contents

  1. Why Electrolytes Matter for Muscle Relaxation
  2. Magnesium Physiology — the Cellular Brake on Calcium
  3. The Serum-vs-Cellular Paradox
  4. Forms of Magnesium — Glycinate, Malate, Citrate, Oxide
  5. Doses Used in Trials and in Practice
  6. Potassium — the Second Most Useful Electrolyte
  7. Calcium and Sodium — Why They Matter Less Than You Think
  8. Drug-Induced Magnesium Depletion
  9. The Cochrane Controversy and How to Read It
  10. Cautions and Interactions
  11. Key Research Papers
  12. Connections
  13. Featured Videos

Why Electrolytes Matter for Muscle Relaxation

The single most important fact about muscle contraction is that relaxation requires energy. A muscle is not "off" in the absence of an active signal — it is held in the relaxed state by the adenosine triphosphate-dependent active pumping of calcium back into the sarcoplasmic reticulum after every twitch. When adenosine triphosphate runs short, calcium accumulates in the cytosol, the actin-myosin cross-bridges stay engaged, and the muscle stays contracted. That sustained involuntary contraction is a cramp.

Three of the four major intracellular and extracellular electrolytes regulate this calcium-management machinery directly:

The interaction matters. Magnesium and calcium compete for some of the same transporters and binding sites — low magnesium effectively unmasks calcium signaling. Magnesium also enables the Na/K-ATPase that maintains the resting membrane potential, so low magnesium produces functional potassium depletion at the cellular level even when serum potassium is normal. This is why magnesium repletion alone often resolves cramps that an unsuccessful potassium-supplementation trial has failed to budge — the patient was magnesium-depleted, with secondary functional potassium depletion.

Back to Table of Contents

Magnesium Physiology — the Cellular Brake on Calcium

The adult human body contains approximately 25 grams of magnesium. About 60% is in bone, 39% is intracellular in soft tissue (predominantly muscle), and less than 1% is in the extracellular space (serum). This distribution explains why serum magnesium is such a poor reflection of total body status — you can have substantial intracellular depletion with completely normal serum levels.

Magnesium serves at least four functions that bear directly on muscle relaxation:

  1. Adenosine triphosphate-Mg complex — adenosine triphosphate only acts as a phosphoryl donor when complexed with Mg2+. The SERCA calcium pump, the Na/K-ATPase, and the myosin ATPase all require Mg-ATP, not free adenosine triphosphate. In magnesium-depleted cells, all three ATPase systems run at reduced capacity, and calcium accumulates in the cytosol after each twitch.
  2. N-methyl-D-aspartate receptor block — in the central and peripheral nervous system, Mg2+ sits in the N-methyl-D-aspartate receptor channel as a voltage-dependent block. Low magnesium increases N-methyl-D-aspartate-mediated excitatory neurotransmission and raises motoneuron excitability, the same axis that contributes to chronic pain syndromes and migraine.
  3. Calcium channel modulation — Mg2+ is a natural calcium-channel antagonist. The clinically used calcium channel blockers (verapamil, diltiazem) work via the same fundamental mechanism that magnesium uses constitutively. Low magnesium effectively un-blocks voltage-gated calcium channels, increasing calcium influx during each depolarization.
  4. Smooth muscle and vascular tone — chronic magnesium depletion is associated with vasoconstriction (one mechanism behind the magnesium-hypertension link) and bronchoconstriction (the intravenous (IV) magnesium sulfate response in severe asthma). These are largely tangential to skeletal muscle cramps but illustrate the breadth of magnesium-dependent smooth-muscle relaxation.

Because the body buffers serum magnesium tightly — and because chronic mild depletion is largely silent — magnesium deficiency is one of the most under-recognized nutritional issues in adult clinical medicine. NHANES survey data suggest 40-50% of US adults consume less than the Estimated Average Requirement for magnesium, and the figure is higher in adults over 70.

Back to Table of Contents

The Serum-vs-Cellular Paradox

The standard "serum magnesium" lab test runs from 1.7 to 2.2 mg/dL in most reference ranges. A patient with a serum magnesium of 1.9 will be reported as "normal" by the lab and is unlikely to receive supplementation from a primary-care physician.

The problem is that less than 1% of body magnesium is in the serum. The serum compartment is actively maintained by mobilization from bone — the body will deplete its own skeleton to keep serum magnesium "normal" right up to the point where bone stores are exhausted. A serum magnesium in the lower half of the reference range is consistent with substantial intracellular depletion, particularly in the presence of any of the chronic depletion risk factors (proton pump inhibitor (PPI) use, loop or thiazide diuretic, alcohol intake, type 2 diabetes, malabsorption, age over 70).

Better tests exist but are less widely used:

The practical takeaway is that a "normal" serum magnesium does not rule out functional deficiency. In the 2020 Cochrane review, oral magnesium caused mostly digestive side effects such as diarrhoea, and major adverse events were no more common than on placebo; 350 mg a day is the adult upper limit for supplemental magnesium, set because higher amounts cause diarrhoea.

Back to Table of Contents

Forms of Magnesium — Glycinate, Malate, Citrate, Oxide

The form of magnesium matters enormously, and most over-the-counter "magnesium" sold in pharmacies is the form with the poorest absorption. The relative bioavailability and clinical profile of the major forms:

Practitioners often say that people who "tried magnesium and it didn't work" had taken a small dose of magnesium oxide from the grocery store, and describe a different result after switching to 350 mg elemental magnesium glycinate. See our Magnesium overview for the broader supplement landscape.

Back to Table of Contents

Doses Used in Trials and in Practice

For idiopathic nocturnal cramps or exercise-related cramping in adults with normal renal function, the trials and practitioners describe the following:

  1. Form: the cramp trials used magnesium citrate supplying 300 mg magnesium a day (Roffe 2002), 900 mg magnesium citrate twice daily (Frusso 1999) and magnesium oxide at bedtime (Roguin Maor 2017). Practitioners commonly use magnesium glycinate at 350-500 mg elemental magnesium per day; amounts over 350 mg are above the 350 mg a day upper limit for supplemental magnesium in adults, which was set because higher amounts cause diarrhoea. On supplement labels, "1,000 mg magnesium glycinate" usually delivers ~140 mg elemental magnesium, because the glycine accounts for the rest of the molecular weight. The elemental amount is what counts.
  2. Timing: practitioners commonly suggest 30-60 minutes before bedtime, on the reasoning that magnesium glycinate's mild calming effect fits with sleep.
  3. Duration: the idiopathic-cramp trials measured results at four weeks (the Cochrane primary endpoint); practitioners commonly allow at least 6 weeks, reasoning that tissue magnesium repletion is slow because the deficit accumulated over years, not weeks. Many responders report partial benefit at 2-3 weeks and fuller benefit at 4-6 weeks.
  4. Co-intervention: practitioners often pair magnesium with the calf-stretch protocol (3 times daily, 10 seconds hold × 3 reps). This is the only intervention with consistent randomized controlled trial evidence for nocturnal cramps.
  5. Diet: magnesium-rich foods include pumpkin seeds (~150 mg per 30 g), almonds (~80 mg per 30 g), spinach (~157 mg per cup cooked), dark chocolate (~65 mg per ounce 70% cocoa), avocado (~60 mg per medium fruit). Real food magnesium is absorbed at similar efficiency to supplements but comes with additional cofactors.
  6. Adjuncts practitioners mention: potassium (mostly from food; see the potassium section below), Vitamin D (deficiency can present with cramping — practitioners check 25-hydroxyvitamin D and replete when it is below 30 ng/mL), Vitamin B6 (a magnesium-transport cofactor; 50 mg pyridoxal 5′-phosphate (P5P) daily for 4 weeks is a dose practitioners use).

When cramps persist unchanged after 6 weeks of 500 mg elemental glycinate (an amount above the 350 mg a day upper limit for supplemental magnesium in adults, which was set because higher amounts cause diarrhoea) plus calf stretching, practitioners regard magnesium as an unlikely cause and look at drug causes, amyotrophic lateral sclerosis (ALS)/peripheral neuropathy when other red flags exist, restless legs / Willis-Ekbom disease (assessed with a sleep study), and (if exercise-associated) the neural reflex remedies.

Back to Table of Contents

Potassium — the Second Most Useful Electrolyte

After magnesium, potassium is the next most commonly implicated electrolyte in cramping. The National Academies' 2019 adequate intake for potassium is 3,400 mg/day for men and 2,600 mg/day for women (replacing the earlier 4,700 mg/day figure), and many adults eat less. The Modern Diet Problem is the inversion of the ancestral sodium:potassium ratio — hunter-gatherer diets provided approximately 1:10 sodium-to-potassium, while a typical processed-food modern diet runs 2:1 or worse. Almost any switch toward more whole-food vegetables and fruits and less processed food improves the ratio.

Food sources, with approximate potassium per typical serving:

For supplementation, over-the-counter (OTC) potassium supplements are limited to 99 mg per pill: a U.S. Food and Drug Administration (FDA) rule (21 CFR 201.306) makes coated tablets supplying 100 mg or more of potassium prescription items, because of reports of small-bowel lesions (narrowing, ulcers, blockage, bleeding and perforation) linked to enteric-coated potassium tablets. High blood potassium (hyperkalemia), which can disturb the heart rhythm, is a separate risk of potassium supplements, particularly in people on angiotensin-converting enzyme inhibitors (ACE inhibitors), angiotensin receptor blockers (ARBs), potassium-sparing diuretics, or with kidney insufficiency. 99 mg is far below a therapeutic dose; potassium repletion beyond what diet provides uses prescription potassium chloride (10-40 mEq).

Food supplies far more. A person eating one banana plus one cup of beans plus one avocado per day is adding roughly 2,100 mg of potassium — substantially more than any non-prescription supplement can deliver. For more on potassium specifically, see our Potassium page.

Coconut water deserves special mention: it provides approximately 600 mg of potassium per cup along with sodium, magnesium, and natural sugars, and endurance athletes who cramp use it for rehydration around exercise.

Back to Table of Contents

Calcium and Sodium — Why They Matter Less Than You Think

Most patients (and many clinicians) overestimate the role of calcium and sodium in routine cramp prevention. Calcium deficiency severe enough to cause cramping (latent tetany, Trousseau's and Chvostek's signs) is genuinely uncommon outside of post-surgical hypoparathyroidism, severe vitamin D deficiency, or chronic kidney disease. Pregnancy was historically thought to be a calcium-cramp setting, but the 2015 Cochrane review on pregnancy cramps concluded that it is unclear whether any of the treatments it examined (oral magnesium, oral calcium, oral vitamin B or oral vitamin C) is effective, mainly because the trials measured outcomes in different, incomparable ways.

The sodium story is more nuanced. Sodium depletion can cause cramping when genuine, but in modern populations most adults consume too much sodium, not too little. The exception is the endurance athlete or outdoor worker who sweats heavily in heat for several hours, replaces with plain water or low-sodium sports drinks, and develops exercise-associated hyponatremia with secondary cramping. That specific scenario is addressed in Hydration Beyond Water.

For the average adult with nocturnal or non-athletic cramps, practitioners regard neither calcium nor sodium supplementation as high-yield. They consider vitamin D repletion (which improves calcium handling) more useful than direct calcium supplementation, and less processed food (which lowers sodium) more useful than salt supplementation.

Back to Table of Contents

Drug-Induced Magnesium Depletion

A surprising number of common medications deplete magnesium and/or potassium and produce cramping as a side effect. Practitioners review the medication list early in a cramp work-up:

The Garrison et al. 2012 pharmacoepidemiology study of prescribing records in adults 50 and older looked at three drug classes: new cramp treatment (quinine) was substantially more likely in the year after starting inhaled long-acting beta-2 agonists, potassium-sparing diuretics or thiazide-like diuretics, while the associations for statins and loop diuretics were small. Cramps that begin within weeks of starting a new medication point to that medication as a possible cause.

Back to Table of Contents

The Cochrane Controversy and How to Read It

The 2020 Cochrane systematic review of magnesium for skeletal muscle cramps (Garrison, Korownyk, Kolber, Allan, Musini, Sekhon, and Dugré) is the most cited source for the position that "magnesium does not work for cramps." A more careful reading is needed.

The review included 11 randomized trials (735 participants total). For idiopathic nocturnal cramps in community-dwelling adults, the pooled effect estimate showed no statistically significant reduction in cramp frequency from magnesium supplementation versus placebo. The 95% confidence interval included the null but also allowed for a modest benefit (the effect could not be definitively excluded).

For pregnancy-associated cramps, the review could not pool the trials. Of the three placebo-controlled pregnancy trials, one found no benefit, one found benefit on both frequency and intensity, and one reported inconsistent results, and the review judged all five pregnancy trials to be at high risk of bias. Its authors called this literature conflicting and said further research is needed.

Practitioners who still use magnesium give several reasons for reading the negative idiopathic-cramps result cautiously:

  1. The magnesium forms differed between trials. Of the trials cited on this page, Roguin Maor 2017 used magnesium oxide; Roffe 2002 used magnesium citrate (300 mg magnesium) and found a non-significant trend toward fewer cramps; Frusso 1999 used 900 mg magnesium citrate twice daily and found no difference from placebo. No trial in the Cochrane analysis used magnesium glycinate, the form practitioners favour for cramps.
  2. The community-dwelling adult population was largely already replete. Cramp trials recruited people with frequent cramps but did not specifically select for low magnesium status. A repletion trial in a population that does not need repletion is destined to underestimate the effect.
  3. Trial durations were 4-6 weeks, which is at the lower end of what may be needed for cellular repletion in chronically depleted individuals.
  4. Outcome measures varied widely — some counted cramp frequency, others severity, others a subjective "improvement" score. Pooling heterogeneous outcomes attenuates effects.
  5. The review's own conclusion is narrow: it found magnesium "unlikely" to provide "clinically meaningful cramp prophylaxis to older adults", found no trials of exercise-associated cramps, and called for more research in pregnancy.

In summary: the 2020 Cochrane review found magnesium unlikely to give meaningful protection to older adults with idiopathic cramps and found the pregnancy trials conflicting. Practitioners still use it because they see responders among people at risk of depletion, its side effects are mostly digestive, and the alternatives have their own limitations (quinine is U.S. Food and Drug Administration-restricted for cramps due to thrombocytopenia risk, calcium channel blockers and benzodiazepines have systemic side effects). The practice they describe is 350-500 mg elemental magnesium glycinate at bedtime for 6 weeks; amounts over 350 mg are above the 350 mg a day upper limit for supplemental magnesium in adults, which was set because higher amounts cause diarrhoea.

Back to Table of Contents

Cautions and Interactions

Back to Table of Contents

Key Research Papers

  1. Garrison SR, Korownyk CS, Kolber MR, Allan GM, Musini VM, Sekhon RK, Dugré N (2020). Magnesium for skeletal muscle cramps. Cochrane Database of Systematic Reviews 9:CD009402 — PubMed PMID: 32956536
  2. Zhou K, West HM, Zhang J, Xu L, Li W (2015). Interventions for leg cramps in pregnancy. Cochrane Database of Systematic Reviews (8):CD010655 — PubMed PMID: 26262909
  3. Roffe C, Sills S, Crome P, Jones P (2002). Randomised, cross-over, placebo controlled trial of magnesium citrate in the treatment of chronic persistent leg cramps. Medical Science Monitor — PubMed PMID: 12011773
  4. Frusso R, Zarate M, Augustovski F, Rubinstein A (1999). Magnesium for the treatment of nocturnal leg cramps: a crossover randomized trial. Journal of Family Practice — PubMed PMID: 10907623
  5. Dahle LO, Berg G, Hammar M, Hurtig M, Larsson L (1995). The effect of oral magnesium substitution on pregnancy-induced leg cramps. American Journal of Obstetrics and Gynecology 173(1):175-80 — PubMed PMID: 7631676
  6. Roguin Maor N, Alperin M, Shturman E, Khairaldeen H, Friedman M, Karkabi K, Milman U (2017). Effect of Magnesium Oxide Supplementation on Nocturnal Leg Cramps: A Randomized Clinical Trial. JAMA Internal Medicine — PubMed PMID: 28241153
  7. Walker AF, Marakis G, Christie S, Byng M (2003). Mg citrate found more bioavailable than other Mg preparations in a randomised, double-blind study. Magnesium Research — PubMed PMID: 14596323
  8. Coudray C, Rambeau M, Feillet-Coudray C et al. (2005). Study of magnesium bioavailability from ten organic and inorganic Mg salts in Mg-depleted rats. Magnesium Research — PubMed PMID: 16548135
  9. Lindberg JS, Zobitz MM, Poindexter JR, Pak CY (1990). Magnesium bioavailability from magnesium citrate and magnesium oxide. Journal of the American College of Nutrition — PubMed PMID: 2407766
  10. Costello RB, Elin RJ, Rosanoff A, Wallace TC, Guerrero-Romero F, Hruby A, et al. (2016). Perspective: The Case for an Evidence-Based Reference Interval for Serum Magnesium: The Time Has Come. Advances in Nutrition — PubMed PMID: 28140318
  11. Schwalfenberg GK, Genuis SJ (2017). The Importance of Magnesium in Clinical Healthcare. Scientifica — PubMed PMID: 29093983
  12. FDA Drug Safety Communication (2011). Low magnesium levels can be associated with long-term use of proton pump inhibitor drugs. PubMed: FDA PPI hypomagnesemia
  13. Garrison SR, Dormuth CR, Morrow RL, Carney GA, Khan KM (2012). Nocturnal leg cramps and prescription use that precedes them: a sequence symmetry analysis. Archives of Internal Medicine — PubMed PMID: 22157068

PubMed Topic Searches

  1. PubMed: Magnesium nocturnal cramp RCTs
  2. PubMed: Magnesium glycinate bioavailability
  3. PubMed: Intracellular magnesium assessment
  4. PubMed: PPI hypomagnesemia
  5. PubMed: Pregnancy cramps and magnesium

Back to Table of Contents

Connections

Back to Table of Contents