One question, one page, one clear answer
Health
Updated 7 July 2026

Why Do My Legs Cramp Up at Night?

Sudden, painful leg cramps that strike during sleep are common and have several identifiable causes. Here's what's behind them.

General information, not medical advice — see terms of use.

Nocturnal leg cramps — sudden, painful tightening of the calf or foot muscles during the night — are very common, especially with age. They're usually harmless, though they can be quite painful.

What happens: - A muscle (usually the calf, sometimes the foot or thigh) involuntarily contracts and won't relax, causing sharp pain and a hard, knotted feeling. - It can last seconds to several minutes, and the muscle may feel sore afterward.

Common causes:

1. Dehydration and electrolyte imbalance: Low levels of minerals like potassium, magnesium, calcium, or sodium can trigger cramps. Dehydration contributes.

2. Muscle fatigue or overuse: Standing or exercising a lot during the day can lead to night cramps.

3. Prolonged sitting or poor positioning: Sitting for long periods or sleeping in a position that shortens the calf muscles.

4. Aging: Leg cramps become more common with age as muscles and nerves change.

5. Pregnancy: Common in later pregnancy.

6. Certain medications: Some diuretics, statins, and blood pressure medications can contribute.

7. Inactivity or, conversely, overexertion.

Less commonly, frequent cramps can relate to: poor circulation, nerve issues, thyroid problems, or kidney conditions.

How to relieve a cramp when it strikes: - Gently stretch the muscle — for a calf cramp, straighten your leg and pull your toes up toward your shin. - Massage the muscle. - Stand up and put weight on the leg, or walk around. - Apply heat to relax the muscle, or cold for soreness afterward.

How to prevent night leg cramps: - Stay well hydrated throughout the day. - Stretch your calves and legs before bed. - Ensure adequate intake of magnesium, potassium, and calcium through a balanced diet. - Keep bedding loose so your feet aren't forced into a pointed position. - Stay moderately active.

When to see a doctor: - Cramps are frequent and severe - They disrupt your sleep regularly - They're accompanied by swelling, redness, or skin changes - They began after starting a new medication - There's muscle weakness alongside the cramps

Most night cramps are benign and respond to hydration and stretching, but frequent or severe cramps are worth discussing with a doctor to rule out underlying causes.

Follow-up questions

What deficiency causes leg cramps at night?

Low levels of magnesium, potassium, calcium, or sodium (electrolytes) are commonly associated with night leg cramps, often alongside dehydration. Ensuring adequate intake of these minerals through a balanced diet and staying well hydrated can help reduce cramps. If cramps persist, a doctor can check for deficiencies and other causes.

How do you stop a leg cramp immediately?

Gently stretch the cramping muscle — for a calf cramp, straighten your leg and pull your toes up toward your shin. Massaging the muscle, standing and putting weight on the leg, walking around, or applying heat can also help the muscle relax. The cramp usually eases within a few seconds to minutes.

How can I prevent leg cramps while sleeping?

Stay well hydrated during the day, stretch your calves and legs before bed, ensure adequate magnesium, potassium, and calcium intake, keep bedding loose so your feet aren't forced into a pointed position, and stay moderately active. These steps reduce the frequency of night cramps for most people.

More health answers

This page is general information, not medical advice, and it may not reflect the latest rules where you live. For your own situation, talk to a qualified clinician. Spotted an error? Email per@upperia.se and we will fix it.