It hits out of deep sleep: your calf locks into a hard, twisting knot, your toes curl on their own, and you’re suddenly wide awake, grabbing your leg. It lasts maybe a minute that feels like ten. The next day, your calf still aches.

Night leg cramps are sudden, painful tightening of a muscle, most often in the calf, and the fastest way to stop one is to stretch that muscle. They’re different from restless legs, which cause an urge to move rather than a cramp. Many night cramps have no single cause, but a few simple habits may make them less frequent. And despite its popularity, magnesium hasn’t been shown to prevent typical cramps in older adults.

Cramp or restless legs? Know which one you have

The two get mixed up all the time, but they feel different and call for different steps:

Night leg cramp Restless legs
What it feels like A sudden, hard, painful knot in a muscle Crawling, pulling, or fizzy feelings with a strong urge to move
Where Usually the calf, sometimes the foot or thigh Usually deep in the legs, both sides
How long Seconds to a few minutes Comes and goes for as long as you’re still
What stops it Stretching the muscle Moving, walking around
Afterward Muscle can stay sore for hours No soreness

If the right-hand column fits you better, our guide on restless legs at night covers causes such as low iron.

And those little twitches?

Brief jerks as you drift off to sleep are common and harmless. They’re different from both cramps and restless legs.

Why night cramps happen

MedlinePlus notes that muscle cramps are common and often harmless, and that they can be linked to:

  • Overusing a muscle, or exercising in heat
  • Sitting for long periods, or sitting or sleeping with your feet pointed
  • Not drinking enough fluids
  • Pregnancy
  • Some medicines
  • Some health conditions, such as nerve or circulation problems

Often, though, no single cause is found.

How to stop a cramp fast

  1. Stretch the muscle. For a calf cramp, sit up, straighten your leg, and pull your toes up toward your shin. If you can’t reach, loop a towel or belt around your foot.
  2. Or stand up and press your heel firmly to the floor, putting weight on the cramping leg.
  3. Massage the muscle gently once it starts to release.
  4. Afterward, use warmth for a tight muscle or a cool pack for soreness.
A bedroom with a bed, dresser, and a window
Photo by Clay Banks on Unsplash

A 3-minute bedtime routine to prevent cramps

Step How to do it Time
Wall calf stretch Stand facing a wall, one foot back, heel down, front knee bent, until you feel a stretch in the back calf 30 seconds per leg, twice
Bent-knee calf stretch Same position, but bend the back knee slightly to stretch the lower calf 30 seconds per leg
Foot circles Sitting, slowly circle each foot 10 each way
Loosen the covers Untuck the sheet at the foot of the bed so your toes aren’t pointed all night
Water A glass of water in the evening if you’ve been active or it’s hot

Doing this most nights for two weeks is a fair test.

What does the research say about magnesium?

Magnesium is one of the most searched remedies for leg cramps. A Cochrane review, which pools results from clinical trials, concluded that magnesium is unlikely to provide meaningful cramp prevention for older adults with typical leg cramps. For cramps during pregnancy, the evidence was conflicting.

The NIH Office of Dietary Supplements notes that high doses of magnesium from supplements can cause diarrhea, nausea, and stomach cramps, and that people with kidney disease face a higher risk of side effects. If you’re thinking about trying magnesium, talk to your doctor or pharmacist first.

Who you are changes the plan

If you’re pregnant

Leg cramps are common in pregnancy. Stretching before bed and staying active usually help. Ask your provider before taking any supplement.

If you’re active or exercise in heat

Drink fluids before, during, and after exercise, and stretch your calves afterward.

If you sit or stand all day

Change position often and walk for a few minutes every hour. Standing on hard floors for long shifts can also tire leg muscles.

If you take a water pill or other daily medicines

Ask your doctor or pharmacist whether any of them could be contributing.

When cramps need a doctor

See a doctor if cramps:

  • Happen often or disrupt your sleep regularly
  • Come with muscle weakness, swelling, redness, or skin changes
  • Aren’t helped by stretching
  • Started after a new medicine

Get care promptly for leg pain with swelling, warmth, and redness in one leg, especially after a long trip or surgery, since that can be a blood clot.

Tonight’s routine

Do the wall stretch for both calves before bed tonight and untuck the sheet at the foot of your bed. Keep a note of how many nights you’re woken by a cramp over the next two weeks. If the count doesn’t drop, take that note to your doctor.

Stiff, achy legs often come with stiff joints in the morning. Our next guide explains why joints feel stiff in the morning and what can help.