Skip to main content
MusculoskeletalICD-10: R25.2Up to 60% of adults experience nocturnal leg cramps at some point; prevalence increases with age

Muscle Cramps

Muscle cramps are sudden, involuntary contractions of one or more muscles that can cause intense pain and temporary inability to use the affected muscle. They most commonly occur in the legs—particularly the calves, hamstrings, and quadriceps—and frequently happen during exercise, at night, or during prolonged sitting. While usually harmless and self-limiting, frequent or severe muscle cramps may indicate an underlying medical condition requiring evaluation.

Symptoms

Sudden, sharp pain in the affected muscle
Visible hardening or tightness of the muscle (palpable knot)
Inability to move the affected muscle during the cramp
Lingering soreness or tenderness after the cramp subsides
Twitching of the muscle before or after the cramp
Cramps that wake you from sleep (nocturnal leg cramps)

Causes

  • Overuse or fatigue of muscles during exercise
  • Dehydration and electrolyte imbalances (sodium, potassium, magnesium, calcium)
  • Poor blood circulation to the muscles (peripheral artery disease)
  • Nerve compression or irritation in the spine
  • Certain medications (statins, diuretics, beta-agonists)

Risk Factors

  • Older age (muscle mass decreases and cramps become more common)
  • Dehydration from inadequate fluid intake or excessive sweating
  • Pregnancy, particularly in the third trimester
  • Strenuous exercise or new physical activity
  • Medical conditions such as diabetes, thyroid disorders, or liver disease
  • Prolonged sitting or standing in one position

Diagnosis

  • Clinical history and physical examination (most cases do not require testing)
  • Blood tests for electrolyte levels (sodium, potassium, magnesium, calcium)
  • Thyroid function tests if thyroid disorder is suspected
  • Electromyography (EMG) and nerve conduction studies for persistent or unusual cramps

Treatment

  • Gentle stretching and massage of the cramping muscle
  • Application of heat (warm towel or heating pad) to the tight muscle
  • Ice application for lingering soreness after the cramp resolves
  • Hydration with electrolyte-containing fluids
  • Magnesium supplementation if deficiency is identified
  • Prescription muscle relaxants for severe, recurrent nocturnal cramps

Prevention

  • Stay well-hydrated, especially during exercise and in hot weather
  • Stretch regularly, particularly before and after exercise
  • Ensure adequate intake of electrolytes (potassium, magnesium, calcium) through diet
  • Warm up properly before physical activity
  • Avoid sudden increases in exercise intensity
  • Consider wearing supportive footwear

When to See a Doctor

  • Muscle cramps are frequent, severe, or do not improve with self-care
  • Cramps are associated with muscle weakness, swelling, or skin changes
  • You develop leg cramps with walking that improve with rest (possible peripheral artery disease)

Frequently Asked Questions

Related Conditions

Have questions about Muscle Cramps?

Ask Mother Nature AI for personalized, evidence-based guidance.

Ask about Muscle Cramps

Medical Disclaimer: This content is for educational and informational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider.

Content reviewed against peer-reviewed medical literature and clinical guidelines. Read our editorial standards.