Close-up of a woman using massage balls for muscle relief

Why Do I Get Leg Cramps at Night? Causes and Relief

Close-up of a woman using massage balls for muscle relief

A sudden, gripping cramp in your calf that jolts you awake at 2am is a uniquely unpleasant way to interrupt a night’s sleep. While it can feel alarming in the moment, nighttime leg cramps are common and usually come down to a handful of well-understood causes.

Quick Answer

Night-time leg cramps are most often caused by muscle fatigue, dehydration, or prolonged sitting during the day. Low levels of magnesium, potassium, or calcium, along with pregnancy and certain medications, can also increase how often they happen.

Common Causes of Night-Time Leg Cramps

Muscle Fatigue and Overuse

Muscles that have been worked hard during the day, through exercise or long periods of standing, are more prone to involuntary cramping once they finally relax at night. Sore, fatigued muscles are covered in more depth in our guide on delayed muscle soreness after a workout.

Dehydration

Low fluid levels affect the balance of electrolytes that muscles need to contract and relax smoothly, making cramping more likely, particularly after a day of heat or exercise. Dehydration can also make you feel dizzy when standing. See our guide on why you might feel dizzy when you stand up.

Electrolyte Imbalances

Low levels of magnesium, potassium, or calcium can all disrupt normal muscle function, increasing the likelihood of sudden, involuntary cramping.

Prolonged Sitting or Poor Posture

Sitting for long stretches, particularly with legs crossed or in an awkward position, can shorten muscles and reduce circulation, making cramps more likely later on.

Pregnancy

Night-time leg cramps are especially common in the second and third trimesters, likely linked to changes in circulation, added weight, and shifting mineral needs.

Medications

Certain diuretics, statins, and asthma medications are associated with an increased likelihood of muscle cramps as a side effect.

Poor Circulation

Conditions that reduce blood flow to the legs can make muscles more prone to cramping, particularly during rest when circulation naturally slows.

Nerve Issues

Less commonly, nerve compression in the lower back or legs can trigger cramp-like sensations, often alongside tingling or numbness.

Young woman in athletic wear stretching her leg on a railing in a park
Most night cramps ease within minutes, and a gentle calf stretch is the first thing to try when one wakes you up.

The first 60 seconds: a timed cramp release routine

A cramp usually lasts from a few seconds to 10 minutes. Work through the steps in order.

Time What to do
0 to 10 seconds Straighten your leg and flex your foot upward, toes toward your shin.
10 to 30 seconds Stand up and put your weight on the leg with the cramp.
30 to 45 seconds Massage the cramping muscle firmly, working from the ankle upward.
45 to 60 seconds Apply a warm compress, then walk gently once the sharpest pain has passed.

The NHS says stretching and massaging may ease the pain, although most cramps go away on their own. Painkillers can help with soreness afterwards, but not while it is happening, because they take too long to work.

The 2 week nightly calf stretch plan

Stretching is the prevention habit the NHS describes in detail. Try it properly for two weeks before deciding whether it helps. The NHS calf stretch is simple: stand facing a wall, hands just touching it, feet flat on the floor, lean forward until your calves stretch, hold for 2 or 3 seconds, then stand up straight. Repeat a few times for 5 minutes, 3 times a day, with the last time just before bed.

Nights What to do
Nights 1 to 3 Wall stretch once, just before bed, for 5 minutes. Note each morning whether you had a cramp.
Nights 4 to 7 Add a second session after your evening meal.
Nights 8 to 14 Do the stretch 3 times a day, the last just before bed.

The NHS says regular calf stretching may help to reduce cramps but may not completely stop them, so judge the plan on fewer and milder cramps, not zero cramps. For more on magnesium and sleep, see our guide on magnesium benefits for health, sleep and energy.

How to Stop a Cramp in the Moment

  • Straighten your leg and gently flex your foot upward, toes toward your shin
  • Massage the cramping muscle firmly to encourage it to release
  • Apply a warm compress or heating pad to relax the muscle
  • Stand and gently walk once the sharpest pain has passed

How to Prevent Future Cramps

  • Stay well hydrated throughout the day, not just before bed
  • Stretch your calves gently before sleeping
  • Eat a balanced diet with adequate magnesium, potassium, and calcium
  • Avoid staying in one position for long stretches during the day
  • Wear supportive footwear if you’re on your feet for long periods

When to See a Doctor

  • Cramps happen frequently and disrupt sleep regularly
  • You notice muscle weakness, numbness, or swelling alongside the cramps
  • Cramps started after beginning a new medication
  • The affected leg looks discoloured or feels warm, which can rarely indicate a circulation issue needing urgent attention

FAQs

Why do leg cramps happen specifically at night?

Muscles that have been active all day are more prone to involuntary contraction once they finally relax during rest, and reduced circulation during sleep may also play a role.

Does drinking water before bed prevent night cramps?

Staying hydrated throughout the day is more effective than a single glass before bed, since dehydration builds up over hours rather than being fixed instantly.

Are leg cramps in pregnancy something to worry about?

They’re very common and usually harmless, but sudden, severe calf pain in pregnancy should be checked promptly to rule out a blood clot, which can present similarly.

Does magnesium help leg cramps?

Not reliably. A Cochrane review found magnesium supplements are unlikely to prevent ordinary cramps in older adults. Food, stretching and hydration are a better use of your effort than tablets.

When should I worry about a leg cramp?

See a GP if cramps disturb your sleep, if you also have numbness or swelling, or if a cramp lasts longer than 10 minutes. Sudden severe calf pain in pregnancy should be checked promptly, and a discoloured or warm leg needs urgent attention.

Conclusion

Night-time leg cramps are usually linked to muscle fatigue, dehydration, or mineral levels, and respond well to simple prevention habits like stretching and staying hydrated. However, cramps that are frequent, severe, or paired with other symptoms are worth discussing with a doctor.

Sources


Last reviewed: August 2026. This article is for general information only and does not replace professional medical advice. If cramps are frequent or severe, please speak to a GP.

Categories: