Why do my muscles cramp and ache?
By Vita · fact-checked against NIH ODS
Vita is Vitaminico's AI nutrition coach. The nutrients below are mapped from the Vitaminico check, and every dose is checked against the NIH Office of Dietary Supplements; these pages have not yet been reviewed by our registered dietitians.
Muscle cramps have many causes. When nutrition is involved, the usual gaps are magnesium, potassium, calcium or sodium — a symptom, not a diagnosis.
Likely nutrient gaps
These are the nutrients most often worth looking at first for this — not a diagnosis, just where the Vitaminico check starts. Read any one to see what it does, the best foods, and how much is too much.
Magnesium
420 mg/dayMagnesium moves calcium and potassium in and out of muscle cells, and NIH ODS lists muscle contractions and cramps as a sign of deficiency. A true shortfall is uncommon in healthy people but real with GI disease (Crohn's, celiac), type 2 diabetes, heavy alcohol use, older age, or long-term PPI/diuretic use.
Vitamin D
15 mcg/dayThe "sunshine vitamin" that helps your body absorb calcium for strong bones and muscles.
What to eat
Food first is the safest place to start. Build your plate around a few of these everyday sources of the nutrients above:
- Pumpkin seeds, almonds, or a square of dark chocolate for magnesium
- Cooked spinach or Swiss chard — one serving covers magnesium, potassium and some calcium
- A banana, a baked potato with the skin, or a handful of dried apricots for potassium
- Black beans or lentils for magnesium plus potassium
- Yogurt, milk, fortified soy milk, or canned sardines with the bones for calcium
- After heavy or hot exercise, water with a pinch of salt or an electrolyte drink to replace sodium
How to confirm it (ask your clinician)
A symptom isn't a diagnosis, and routine bloodwork is often normal in ordinary nighttime leg cramps. See a clinician — and ask about a basic metabolic panel/electrolytes (magnesium, potassium, calcium) plus vitamin D — if cramps are frequent, severe, wreck your sleep, or come with muscle weakness, numbness, swelling, or a fast/irregular heartbeat, or if you take diuretics or have GI disease, diabetes, or heavy alcohol use. Don't self-diagnose a deficiency from an app quiz; use it to decide whether a conversation with a doctor or dietitian is worth having.
Not sure which gap is yours?
The free 2-minute Vitaminico check reads your symptoms across 9 body systems and names your most likely gap — food-first, no pills pushed.
FAQ
Does getting cramps mean I have a nutrient deficiency?
No. Most occasional cramps come from muscle fatigue or overuse, holding one position too long, pregnancy, poor circulation, certain medications, or losing fluid and salt during heavy sweating. A true mineral deficiency is only one possible cause — and blood tests in people with ordinary cramps often come back normal.
Will a magnesium supplement stop my cramps?
Only if you're genuinely low. A Cochrane review found magnesium supplements are unlikely to help ordinary (idiopathic) muscle cramps, and one trial found that correcting vitamin D didn't reduce cramps either. Get minerals from food first, and confirm a real deficiency with a clinician before relying on pills.
Which nutrients matter most for muscle cramps?
The electrolytes that run nerve-to-muscle signaling: magnesium, potassium, calcium and sodium. A genuine shortfall of any of them can trigger cramping, but they're most likely to run low in specific situations — heavy sweating, diuretic use, GI disease, or a very limited diet — rather than in a typical eater.
Does dehydration cause cramps?
During hot or prolonged exercise, losing both fluid and sodium in sweat is a well-documented cramp trigger, so replacing salt and water helps. The link between everyday daytime dehydration and nighttime leg cramps is much weaker and not clearly proven.
When should I see a doctor about muscle cramps?
If cramps are frequent, severe, disrupt your sleep, or come with muscle weakness, numbness, swelling, or a fast or irregular heartbeat — or if you take diuretics or statins, or have diabetes, kidney disease, GI disease, or heavy alcohol use. Those deserve a real medical workup rather than guesswork.
Vitaminico for iPhone
Get your full picture in the app
- A free 2-minute chat with Vita reads your symptoms — no food-logging, no needles
- Your top 3 likely nutrient gaps across the vitamins and minerals that matter
- A food-first plan: what to eat, where to get it, and what to skip
- No signup wall — the full check works the moment you open the app
Free · iPhone · no email to start

Educational, not medical advice. This page does not diagnose a deficiency or any condition. Symptoms can have many causes, nutritional and otherwise — only a clinician and, where needed, a blood test can confirm a real gap. Talk to your doctor before starting any high-dose supplement.