animated leg with red cramping spot in the calf

Why Are My Legs Cramping?

What are leg cramps?

Leg cramping is an incredibly common condition, seen in a third or more of adults over the age of 50.1 It is characterized by a sudden, involuntary, sustained or repetitive, and painful contraction of muscle(s) in the legs, with each episode lasting from a few seconds to many minutes. The symptoms typically occur in the calves, but can also occur in the feet and less commonly in the thighs. Cramps tend to occur while a person is in bed, either awake or asleep, and often cause difficulty sleeping as a result.1 

Leg cramps are different from restless legs syndrome (RLS), which also occurs at night, but is characterized by an uncomfortable sensation in the lower extremities with an associated urge to move the legs. Notably, RLS is usually a continuous sensation and may be associated with brief involuntary movements, but not sustained contraction of muscle.2

Cramping is also differentiated from pain due to peripheral neuropathy, which also occurs frequently at night but is often described as a painful burning, tingling sensation most often felt in the feet.

Finally, peripheral vascular disease may result in cramp-like leg pain; however, these symptoms typically occur during limb use and are relieved with rest, unlike typical leg cramping.

What causes leg cramps?

Leg cramping is most commonly idiopathic with no identifiable cause, though age-related shortening of muscle length has been suggested as a risk factor3 as well as certain medical conditions. Some diseases affecting the nerves in the legs, such as peripheral neuropathy and lumbar stenosis have been associated with leg cramping.4

Other neurologic disorders associated with leg cramping include Parkinson’s disease, myopathies, neuropathies, radiculopathies, and motor neuron diseases. Additional associated medical conditions include chronic liver and renal failure (particularly with dialysis), vascular diseases, and varicose veins.5,6

Leg cramping is also known to be a symptom of magnesium deficiency. This is true in pregnancy where such an insufficiency often causes leg cramps, another one of the many aches and pains of pregnancy. Notably, as just 1% of the body’s magnesium is found extracellularly, routine blood testing is often normal and unrevealing.9

Other electrolyte abnormalities (such as potassium and sodium) as well as dehydration can also cause cramping.3,7,8 In addition, metabolic disorders associated with leg cramping include diabetes, hypoglycemia, alcoholism, and hypothyroidism. Finally, multiple medications are implicated with this symptom including diuretics, intravenous iron, raloxifene, estrogen hormone therapy, and certain inhalers used in COPD.3 

How are leg cramps diagnosed?

Leg cramping is diagnosed clinically, using a combination of history and physical exam. Assessing for predisposing factors, underlying medical conditions, and contributing medications is the first step. A thorough physical exam should include inspection and palpation of the lower extremities and a neurological exam.

An assessment of the vasculature is critical, which includes testing for lower extremity pulses and evaluating for other signs of vascular disease. In certain circumstances, laboratory tests and imaging studies may be indicated.

Can I prevent leg cramping?

The safest intervention to prevent leg cramping is calf stretching and massage prior to bedtime. These stretches can also be used after a leg cramp has occurred to provide relief and shorten the duration of symptoms.

There is also limited evidence that light exercise (such as a stationary bike or walking on a treadmill) prior to bedtime can help prevent as well as alleviate symptoms.10  Walking or shaking out the legs, leg elevation, hot showers with the stream directed at the cramp, warm tub baths, and ice massage may also be helpful.

Finally, proper shoe wear, keeping bed covers loose at the end of the bed, adequate hydration, limiting alcohol and caffeine, and avoiding exercise in extreme heat are other strategies that can help prevent leg cramping.

What are the treatment options for leg cramps?

For an acute cramp, the most common strategy to relieve the pain is forceful active stretching such as actively dorsiflexing the foot (bringing the toes to the nose) while the knee is extended if the cramp is in the calf. Passive stretching like getting out of bed and standing with the foot flat on the floor and pressing downward can also be helpful.

In addition to stretching, magnesium has been suggested as a low-risk intervention for leg cramping. A recent large-scale analysis concluded that magnesium supplementation is “unlikely” to provide clinically meaningful prevention of leg cramping in older adults12, however, due to the low cost and relatively low risk, a trial of magnesium supplementation is often recommended.3 Vitamin B complex and vitamin E have also been used for leg cramps.

Finally, nerve pain medications (like gabapentin) can be helpful in some patients, but evidence is lacking to provide a strong recommendation for their use.13,14 In fact, due to limited evidence for their benefit, no medications are uniformly prescribed for leg cramping.

Historically, an anti-malarial drug called quinine was used for the treatment of leg cramps. However, in 2006 the FDA issued a warning suggesting that quinine’s potential risks outweigh the small symptomatic benefit, and thus discouraged the use of quinine-containing products for any use other than treatment of malaria.3,11 Quinine can also be associated with potentially fatal arrhythmias, low blood platelets, and allergic-type reactions.11

Schedule an Appointment Today

Most cases of leg cramping are idiopathic and without a directly identifiable cause. There are many conditions, however, that can contribute to this symptom, including vascular conditions as well as nerve disorders such as lumbar stenosis and peripheral neuropathy.

Your doctor may order blood work, imaging studies, or other testing to evaluate for such underlying conditions. A trial of stretching, massage and light exercise should be initiated in most patients prior to medication management. While magnesium supplementation is a low-risk strategy that may provide relief of symptoms, there is limited evidence to support regular use of any particular medication.

If you have questions regarding leg cramping, including whether it may be related to your spine or nerve-related conditions, please contact us to schedule your appointment at Desert Spine and Sports Physicians for an evaluation. 



  1. Hallegraeff J, de Greef M, Krijnen W, van der Schans C. Criteria in diagnosing nocturnal leg cramps: a systematic review. BMC Fam Pract. 2017 Feb 28;18(1):29.
  2. Hening WA, Allen RP, Washburn M, Lesage SR, Earley CJ. The four diagnostic criteria for restless legs syndrome are unable to exclude confounding conditions (“mimics”). Sleep Med. 2009;10(9):976-981.
  3. Allen RE, Kirby KA. Nocturnal leg cramps. Am Fam Physician. 2012;86:350–5.
  4. Matsumoto M, Watanabe K, Tsuji T, et al. Nocturnal leg cramps: a common complaint in patients with lumbar spinal canal stenosis. Spine (Phila Pa 1976). 2009;34(5):E189-E194
  5. Monderer RS, Wu WP, Thorpy MJ. Nocturnal leg cramps. Curr Neurol Neurosci Rep. 2010;10:53–9.
  6. Bahk JW, Kim H, Jung-Choi K, Jung MC, Lee I. Relationship between prolonged standing and symptoms of varicose veins and nocturnal leg cramps among women and men. Ergonomics. 2012;55:133–9.
  7. Schwellnus MP, Nicol J, Laubscher R, Noakes TD. Serum electrolyte concentrations and hydration status are not associated with exercise associated muscle cramping (EAMC) in distance runners. Br J Sports Med. 2004;38(4):488-492.
  8. Sulzer NU, Schwellnus MP, Noakes TD. Serum electrolytes in Ironman triathletes with exercise-associated muscle cramping. Med Sci Sports Exerc. 2005;37(7):1081-1085.
  9. Coghlan HC, Natello G. Erythrocyte magnesium in symptomatic patients with primary mitral valve prolapse: relationship to symptoms, mitral leaflet thickness, joint hypermobility and autonomic regulation. Magnes Trace Elem. 1991-1992;10:205-214.
  10. Daniell HW. Simple cure for nocturnal leg cramps. N Engl J Med. 1979;301(4):216.
  12. Garrison SR, Korownyk CS, Kolber MR, Allan GM, Musini VM, Sekhon RK, Dugré N. Magnesium for skeletal muscle cramps. Cochrane Database Syst Rev. 2020 Sep 21;9(9):CD009402. doi: 10.1002/14651858.CD009402.pub3. PMID: 32956536; PMCID: PMC8094171.
  13. Serrao M, Rossi P, Cardinali P, Valente G, Parisi L, Pierelli F. Gabapentin treatment for muscle cramps: an open-label trial. Clin Neuropharmacol. 2000;23(1):45–49. 
  14. Guay DR. Are there alternatives to the use of quinine to treat nocturnal leg cramps?. Consult Pharm. 2008;23(2):141-156.