The short answer: Most night leg cramps have no clear cause. Doctors call them idiopathic. They become more common with age, and some medicines, pregnancy, and conditions such as vascular disease make them more likely. Dehydration and low electrolytes get most of the blame, but studies have not linked them to night cramps.
What exactly is a nocturnal leg cramp?
A nocturnal leg cramp is a sudden, painful, involuntary tightening of a muscle in the leg or foot during rest or sleep. A review in American Family Physician says the calf is the most common site, but the foot and thigh also cramp. The muscle often feels hard and knotted.
The same review gives some useful details:
- An episode lasts about nine minutes on average.
- Repeat cramps and soreness can follow for hours.
- Cramps often wake people up and cause trouble getting back to sleep.
- Up to 20% of people with cramps have them often enough to seek care.
The calf may be at a special disadvantage at night. When you lie down with your toes pointed, the calf muscle sits in its most shortened position. A shortened, tired muscle appears to fire more easily.
How common are night leg cramps, and who gets them?
They are very common. The AAFP review reports that 50% to 60% of adults have had them, and about 7% of children. The rate rises with age, and women are slightly more affected.
A study of 365 outpatients aged 65 and over in Exeter, UK, found that 50% had leg cramps. Cramps were more common in women (56%) than men (40%). Most cramps (62%) happened at night. For 20% of those affected, the cramps had gone on for more than 10 years. Only 40% had told their doctor.
Pregnancy is also linked to leg cramps. A 2020 Cochrane review names pregnancy, older age, exercise, and nerve disorders as common settings for cramps.
What causes leg cramps at night?
For most people, no single cause turns up. The AAFP review says most cases are idiopathic. The leading theories are muscle fatigue and overactive signals from the nerves that control the muscle.
Some conditions are linked to more cramps. The AAFP review lists these:
- Peripheral artery disease and other cardiovascular disease
- Venous insufficiency (poor blood return in the leg veins)
- Lumbar spinal stenosis
- Peripheral neuropathy and Parkinson disease
- Cirrhosis and hemodialysis
- Osteoarthritis
The Exeter study found a similar pattern. Cramps were strongly tied to peripheral vascular disease and arthritis. Heart failure, high blood pressure, diabetes, and stroke were not tied to cramps in that group.
What about water and salts? MedlinePlus notes that dehydration and low electrolytes can raise cramp risk, mainly during exercise. Night cramps at rest are different. The AAFP review says dehydration and electrolyte problems have not been shown to cause them. For the same reason, it advises against routine blood tests unless a specific condition is suspected.
Can medications cause leg cramps at night?
Yes, some can. A large British Columbia study tracked 4.2 million residents. It looked at adults 50 and older who started a cramp treatment after starting another drug. The researchers found cramp treatment was clearly more likely in the year after people began:
- Inhaled long-acting beta-agonists (asthma and COPD inhalers)
- Potassium-sparing diuretics
- Thiazide-like diuretics
The links for statins and loop diuretics were small. The AAFP review lists other drugs with reported links. These include intravenous iron sucrose, conjugated estrogens, raloxifene, naproxen, and teriparatide.
If your cramps started soon after a new prescription, tell your doctor or pharmacist. Do not stop a prescribed medicine on your own. Many of these drugs treat serious conditions, and there may be other options.
What else could it be besides a cramp?
Several problems can feel like a leg cramp. The AAFP review explains how to tell them apart:
- Claudication. Cramping or aching in the calf that comes on with walking and eases with rest. It can point to narrowed leg arteries. Our guide to heavy, tired legs covers this in more detail.
- Restless legs syndrome. An urge to move the legs in the evening that movement relieves. It is uncomfortable rather than painful, and the muscle does not knot up.
- Peripheral neuropathy. Numbness, tingling, or electric pain, not tied to sleep or exercise. See our article on numbness and tingling.
- Myositis or myalgia. A deep ache with weakness that lasts, sometimes from statins. Our page on muscle aches without exercise explains the common causes.
A blood clot is the one to take most seriously. The NHLBI describes deep vein thrombosis as swollen, tender legs that are painful to the touch. A cramp fades within minutes. Clot pain persists and comes with swelling.
What helps stop or prevent night cramps?
During a cramp, stretch the muscle. For a calf cramp, pull your toes up toward your shin or stand and press your heel down. MedlinePlus also suggests massage and heat during the spasm.
For prevention, the evidence is limited. Here is what the studies show:
- Nightly stretching. A 2012 randomized trial enrolled 80 adults over 55. Those who stretched their calves and hamstrings just before bed for six weeks had fewer and less painful cramps than the control group. An earlier trial cited by AAFP found no effect, so results are mixed. Stretching is cheap and low risk.
- Magnesium. The 2020 Cochrane review pooled 11 trials with 735 people. It concluded that magnesium is unlikely to provide meaningful cramp prevention for older adults. Results in pregnancy were conflicting. Magnesium caused more stomach side effects, mostly diarrhea. For a broader look at magnesium and other supplements, see supplements.md.
- Quinine. Do not use it for cramps. The FDA warned in 2010 that its serious risks outweigh any modest benefit, as the AAFP review notes. The Qualaquin label carries a boxed warning. It says use for night leg cramps may cause serious and life-threatening blood reactions. The drug is approved only for a type of malaria.
Treating a linked condition, such as poor circulation, makes sense on its own. The AAFP review notes there is little data showing it relieves cramps, though.
When should you see a doctor about leg cramps?
Occasional night cramps that ease with stretching are usually harmless. MedlinePlus advises contacting a provider when cramps are severe, keep coming back, last a long time, or do not improve with stretching.
Get checked sooner if you notice any of these:
- One leg is swollen, warm, or tender and the pain does not fade
- Calf pain comes on every time you walk and eases with rest
- Numbness, tingling, or weakness in your legs or feet
- Muscle pain or weakness that lasts between cramps
- Cramps that began after starting a new medicine
Shortness of breath or pain when breathing can mean a clot has moved to the lungs, according to the NHLBI. Treat that as an emergency.
The bottom line
Night leg cramps are common, more so with age, and most have no clear cause. Muscle fatigue and nerve signals, not dehydration, are the leading explanations. Some inhalers and diuretics raise the odds. Nightly calf stretching has the best low-risk evidence. Magnesium has not held up in older adults, and quinine is unsafe for cramps. A swollen, tender leg or pain with walking needs a doctor's look.
Last updated: October 2026. This article is for informational purposes only and does not constitute medical advice. Talk with your doctor before changing any medicine or starting a supplement for leg cramps.