Muscle cramps can come from low levels of magnesium, potassium, calcium, sodium, phosphate, vitamin D and some B vitamins. The first step is to find out which, if any, applies to you, because the fixes, doses and safety limits differ for each. This guide walks through each nutrient, the evidence behind it, the numbers that define a deficiency, the foods that supply it and the situations where cramps point to something that needs a clinician. You can then look up each ingredient's dosing and trial citations in our supplement ingredient database.
TL;DR
- Electrolyte shortfalls (magnesium, potassium, calcium, sodium, phosphate) and low vitamin D or B vitamins are the nutrient causes clinicians list for muscle cramps.
- Magnesium and potassium are tied together: low magnesium can drive potassium loss, so a cramp problem may involve both.
- Weakness plus cramps, or cramps that are frequent and severe, need a blood test and a clinician, because medications, kidney, thyroid and hormone problems can look the same.
- Magnesium supplements have a 350 mg/day upper limit, and potassium supplements are risky with kidney disease or certain blood pressure drugs.
- Match the nutrient to your symptoms with our symptom-based supplement search and the deficiency guide.
Table of Contents
- What a nutrient-related cramp looks like
- Magnesium: the most common suspect
- Potassium: weakness first, cramps second
- Calcium, sodium and phosphate
- Vitamin D and the B vitamins
- Match your symptoms to a likely deficiency
- When cramps are not about nutrients
- Our perspective
- Put the evidence to work
- FAQ
- Sources
What a nutrient-related cramp looks like
A cramp is a sudden, painful, involuntary muscle contraction, often in the calf, foot, thigh or hand. Most cramps are brief and harmless. Clinical references describe metabolic causes that include low blood calcium (hypocalcemia), low potassium (hypokalemia), low magnesium (hypomagnesemia), low sodium (hyponatremia), low phosphate (hypophosphatemia), and deficiencies of vitamin B and vitamin D, as listed in StatPearls, updated September 2025.
The useful question is not "which vitamin stops cramps?" but "which deficiency fits my pattern?" Clues that point to a nutrient cause:
- Cramps that arrive with a long stretch of poor eating, heavy sweating, vomiting or diarrhea.
- Cramps that began after starting a diuretic (water pill), a proton pump inhibitor or another medication that changes mineral balance.
- Cramps along with fatigue, numbness, tingling, nausea or loss of appetite.
- Cramps along with a diet low in vegetables, beans, nuts, seeds, dairy or fish.
None of these confirms a deficiency. A blood test does.
Magnesium: the most common suspect
Magnesium helps muscles relax after they contract, so it is the mineral most often linked to cramps. The NIH Office of Dietary Supplements says that as magnesium deficiency worsens, people can develop numbness, muscle contractions and cramps, seizures and abnormal heart rhythms. Early signs are less specific: loss of appetite, nausea, vomiting, fatigue and weakness.
The same fact sheet defines low serum magnesium (hypomagnesemia) as below 0.75 mmol/L, with a normal range of 0.75 to 0.95 mmol/L. A 2025 clinical guideline for ambulatory care adds a nuance worth knowing: it lists leg cramps as a major risk criterion for assessing magnesium deficiency and notes that readings of 0.75 to 0.85 mmol/L can still hide a chronic shortfall despite a "normal" lab report. If you have cramps and a result near the low end of normal, ask your clinician what it means for you.
Daily targets and food sources
The NIH recommended daily allowance for magnesium is 310 to 320 mg for adult women and 400 to 420 mg for adult men, depending on age. Foods that supply it, per the NIH fact sheet:
| Food | Magnesium |
|---|---|
| Pumpkin seeds, 1 oz | 156 mg |
| Chia seeds, 1 oz | 111 mg |
| Almonds, 1 oz | 80 mg |
| Boiled spinach, ½ cup | 78 mg |
| Black beans, ½ cup | 60 mg |
Only about 30 to 40% of dietary magnesium is absorbed, which is why a diet that looks adequate on paper can still fall short. Our magnesium deficiency guide lists the groups most at risk, and the magnesium deficiency symptoms article shows what to watch for beyond cramps.
Supplement forms and limits
If you and your clinician decide a supplement fits, the form matters for tolerance and absorption. Our profiles cover magnesium citrate with its dosage and trial citations and SiMag, a sucrosomial magnesium, so you can compare them side by side.
Know the ceiling. The Tolerable Upper Intake Level for supplemental magnesium is 350 mg/day for adults. Higher supplemental doses can cause diarrhea, nausea and abdominal cramping, and very high intakes can cause toxicity, with the risk rising in kidney failure, according to the NIH. Note that this ceiling applies to supplements, not to magnesium from food. When a clinician diagnoses a true deficiency, repletion is a medical decision: the 2025 guideline describes doses of at least 600 mg elemental magnesium daily with lab monitoring after one month and then every three months, which is why it should be supervised and not self-directed.
For a deeper look at how magnesium intake relates to the skeleton, see this review of magnesium and bone health evidence, which also covers how supplementation is studied and what side effects to expect.
Potassium: weakness first, cramps second
Potassium carries the electrical signal that tells a muscle to contract and release. When blood potassium is low, mild cases bring constipation, fatigue and muscle weakness, and moderate to severe cases (below 2.5 mmol/L) can bring paralysis, poor breathing and heart rhythm problems, per the NIH potassium fact sheet. The same source says low potassium is mostly a problem of hospitalized patients and people on diuretics and other medications, and is rare in healthy people with normal kidney function.
That does not make dietary potassium irrelevant. In a study of 230 postmenopausal women, those who had cramps ate significantly less potassium than those who did not (about 2,665 versus 3,018 mg a day). The National Academies set an adequate intake of 4,700 mg/day for adults, and the NIH notes that average U.S. intakes fall below it: about 3,016 mg/day for men and 2,320 mg/day for women in the 2013 to 2014 survey. The National Academies also point out that moderate potassium shortfall can occur without low blood potassium, showing up as higher blood pressure and salt sensitivity, so a normal potassium result does not settle the question of diet quality.

The magnesium connection
The NIH reports that magnesium depletion increases urinary potassium loss, and that more than half of people with clinically significant low potassium may also be short of magnesium. When both are low, both need to be corrected together. If potassium keeps testing low despite treatment, ask whether magnesium was checked. Our potassium deficiency guide and the article on low potassium symptoms and the threshold to act cover the signs in detail.
Safe use
Potassium is the one to be careful with. People with kidney disease, and people taking ACE inhibitors, ARBs or potassium-sparing diuretics, are at risk of high potassium (hyperkalemia), which can itself cause muscle weakness, paralysis and dangerous arrhythmias. The FDA has also ruled certain oral drug products with more than 99 mg of potassium chloride unsafe because of small-bowel lesions, which is why over-the-counter potassium supplements are small. Food is the safe route for most people: beans, potatoes, leafy greens, yogurt and fruit. If you take any of the medications above, talk to your prescriber before changing potassium intake.
Calcium, sodium and phosphate
These three are almost always handled through a doctor, because they shift with illness and medication far more than with diet. The American Family Physician review notes that calcium, phosphate, potassium and sodium disturbances are all linked to muscle weakness. Low sodium shows up after heavy sweating combined with plain-water intake, or with some medications. Low calcium can follow thyroid-related or kidney-related problems. A basic metabolic panel (a routine blood test) shows sodium, potassium and calcium in one draw, which is why it is the usual first step.
Vitamin D and the B vitamins
Vitamin D deficiency is best known for muscle weakness, not classic cramps. The Endocrine Society guideline defines deficiency as a 25(OH)D level below 20 ng/mL and insufficiency as 21 to 29 ng/mL. It states that deficiency causes proximal muscle weakness, diffuse muscle pain and gait trouble, meaning weakness around the hips and shoulders that makes climbing stairs or standing from a chair harder. In one double-blind trial it cites, adults over 65 who took 800 IU of vitamin D3 daily gained 4 to 11% in lower-extremity strength or function and had up to 72% fewer falls after five months.
The NIH recommends 15 mcg (600 IU) a day for most people and 20 mcg (800 IU) for those 70 and older. It advises against more than 100 mcg (4,000 IU) a day unless a health care provider is treating you, and lists fatty fish, fortified milk, egg yolks and sun exposure as sources.

StatPearls also lists B vitamin deficiency among metabolic causes of cramps, and notes small trials of vitamin B, vitamin E and vitamin K. In one, 180 µg of vitamin K2 helped adults 65 and older, per StatPearls. Those are early findings, but they show why a broad look at the whole vitamin and mineral picture is more useful than fixating on one nutrient.
Match your symptoms to a likely deficiency
| What you notice | Nutrients to look into | Typical next step |
|---|---|---|
| Cramps with fatigue, nausea, poor appetite, tingling | Magnesium | Serum magnesium test, food review |
| Weakness and constipation, especially on a diuretic | Potassium (and magnesium) | Basic metabolic panel, prescriber review |
| Cramps after heavy sweating and plain water | Sodium, electrolytes | Replace fluids with electrolytes, see a clinician if it recurs |
| Weakness in hips and thighs, bone or muscle aches, little sun | Vitamin D | 25(OH)D blood test |
| Cramps and weakness in people with limited diets | B vitamins, others | Review diet, test per clinician |
Our deficiency guide by group shows how pregnancy and older age change the picture, and the main vitamin and mineral deficiencies index lets you read each one's symptoms and risk groups. For ingredient options that match a cramp complaint, our muscle and leg cramp supplement guide rates the evidence behind each.
When cramps are not about nutrients
Muscle weakness affects about 5% of U.S. adults aged 60 and older, and the cause can be hard to pin down. The American Family Physician review explains that clinicians first separate true weakness from fatigue or pain, then grade it, because the list of causes spans neurologic, rheumatologic, endocrine, genetic, medication-related and infectious conditions. Low potassium specifically can come from diuretics, kidney tubule disorders, excess aldosterone and an overactive thyroid.
See a clinician promptly if you have:
- Cramps that are frequent, severe or wake you most nights.
- Weakness, not just pain, especially if it is getting worse.
- Cramps along with palpitations or an irregular heartbeat, which can point to electrolyte problems.
- Swelling, dark urine or reduced urination, which can signal kidney problems.
- Cramps that began after a new medication.
Call emergency services for chest pain, trouble breathing, or sudden paralysis or weakness.
Our perspective
Most people who search for a cramp fix want a single nutrient to blame. The research does not work that way. Magnesium, potassium, calcium, sodium and vitamin D each have a defined deficiency threshold, a defined intake target and a defined safe ceiling, and the right move depends on which one is actually low.
That is why we built NutraSmarts around evidence you can check. Every ingredient profile is tied to PubMed-cited research, clinical dosage benchmarks and an honest evidence rating, and our deficiency guide lists symptoms and at-risk groups so you can bring a specific question to your clinician. Our comparison tool lets you set magnesium forms or other ingredients next to each other before you decide.
There is no sign-up and no paywall. We would rather you arrive at your appointment knowing the numbers than guess from a product label.
NutraSmarts
Put the evidence to work
If you want to move from a symptom to a short list of ingredients, start with our supplements-by-symptom search. It lets you look up a concern such as leg cramps or weakness and see which ingredients have clinical support, at what dose. Each profile links to its trial citations.

Formulators and coaches can use the same database for dosage ranges and citations, and the free Supplement Facts label creator builds an FDA-compliant label in the browser without spreadsheets.
FAQ
What deficiency causes muscle cramps?
Magnesium is the one most often linked, followed by potassium, calcium and sodium. Low vitamin D and B vitamins are also on clinical lists of metabolic causes. A blood test is the only way to know which applies to you.
Which vitamins help with muscle weakness?
Vitamin D is the best documented: the Endocrine Society says deficiency causes proximal muscle weakness, and an 800 IU daily dose improved lower-body strength in adults over 65 in a trial it cites. Magnesium and potassium shortfalls also cause weakness. Check your levels first and stay within the NIH upper limits.
Can low potassium and low magnesium cause cramps together?
Yes. Magnesium depletion raises urinary potassium loss, and the NIH notes that when both are low, both should be corrected together. A clinician can order both tests at once.
How much magnesium is safe from supplements?
The NIH upper limit for supplemental magnesium is 350 mg a day for adults. Exceeding it commonly causes diarrhea and stomach cramping, and kidney disease raises the risk of serious toxicity. Clinician-directed repletion can differ from this, so follow your clinician's plan.
Sources
- Muscle Cramps, StatPearls (NCBI Bookshelf)
- Magnesium, Health Professional Fact Sheet (NIH Office of Dietary Supplements)
- Potassium fact sheet (NIH Office of Dietary Supplements)
- Muscle Cramps Do Not Improve With Correction of Vitamin D (WMJ, 2017)
- Dietary Reference Intakes for Water, Potassium, Sodium, Chloride, and Sulfate (National Academies)
- Clinical Guideline for Detection and Management of Magnesium Deficiency in Ambulatory Care (2025)
- Muscle Weakness in Adults: Evaluation and Differential Diagnosis (American Family Physician, 2020)
- Evaluation, Treatment, and Prevention of Vitamin D Deficiency (Endocrine Society guideline)
- Vitamin D, Frequently Asked Questions (NIH Office of Dietary Supplements)
- Magnesium and Bone Health: What the Evidence Actually Shows
