CONDITIONS

Night Leg Cramps: Why They Happen, What Helps, and Whether Magnesium Works

Night leg cramps are common, usually harmless and last a few seconds to 10 minutes. Calf stretching may reduce them. A Cochrane review found magnesium unlikely to help older adults with cramps. One swollen, painful, red leg needs a doctor today; with chest pain or breathlessness, call emergency services now.

Updated 2026-11-228 min read6 cited sourcesEducational — not medical advice

Illustrative — a plain schematic figure; it does not mark where cramps happen. Night leg cramps are most often in the calf, the muscle below the knee at the back of the leg.

In short

Night leg cramps are common, usually harmless and last a few seconds to 10 minutes. Calf stretching may reduce them. A Cochrane review found magnesium unlikely to help older adults with cramps. One swollen, painful, red leg needs a doctor today; with chest pain or breathlessness, call emergency services now.

Emergency if: One leg is swollen and painful, and you also have chest pain or feel short of breath: call emergency services now. These can be signs that a clot has travelled to the lungs. Do not drive yourself.

On your report

Magnesium, Calcium, Potassium

On this page

01

Why do I get leg cramps at night?

The NHS says leg cramps are common, usually harmless and only last a short time. They can happen at any time, but most people have them at night or when resting. A cramp is a muscle in the leg tightening and causing a sudden pain that can make it hard to move. It lasts from a few seconds to 10 minutes, most often in the calf muscle below the knee at the back of the leg, and less often in the feet or thighs. The muscle may feel sore for up to 24 hours afterwards.

The NHS lists these causes: ageing, too much strain on the muscles during exercise (worse in hot or humid weather), pregnancy (usually the later stage), certain medicines such as statins for cholesterol or diuretics for high blood pressure, not drinking enough fluids, and liver disease from drinking too much alcohol. For some cramps the reason is unknown. MedlinePlus says straining or overusing a muscle is the most common cause of cramps in general, and adds nerve compression, dehydration, low levels of electrolytes such as magnesium, potassium or calcium, not enough blood reaching the muscles, and dialysis. It says cramps are more common in older adults, people who are overweight, athletes, pregnant women and people with thyroid or nerve disorders.

02

How do I stop a leg cramp right now?

The NHS says stretching and massaging the muscle may ease the pain during a cramp, although most cramps go away without you doing anything. Standing up and putting your weight on the leg with the cramp may also help. MedlinePlus adds heat when the muscle is tight and ice when it is sore.

Painkillers will not help while the cramp is happening. The NHS says paracetamol or ibuprofen can ease muscle soreness after a cramp, but they take too long to work to stop one.

03

How do I stop night leg cramps coming back?

The NHS says regular calf-stretching exercises may help to reduce cramps but may not completely stop them. Its method: stand facing a wall and stretch out your arms until your hands can just touch it, with your feet flat and your body straight. Lean forward, pressing your hands against the wall until you feel your calf muscles stretch, and hold for 2 or 3 seconds. Stand up straight again and repeat a few times for 5 minutes, 3 times a day, the last time just before bed. If cramps become less frequent, you might only need to do it once or twice a day.

MedlinePlus gives the same two habits: if you often get leg cramps at night, stretch your leg muscles before bed, and drink plenty of liquids.

Six steps. 1, during a cramp: stretch or massage the muscle, stand and put weight on the leg. 2, after it passes: the muscle can stay sore for up to 24 hours; paracetamol or ibuprofen can ease soreness but work too slowly to stop a cramp. 3, calf stretch, 3 times a day: face a wall, lean forward until the calf stretches, hold 2 or 3 seconds, repeat for 5 minutes, 3 times a day, the last time just before bed. 4, if cramps get fewer, once or twice a day may be enough. 5, book a visit if cramps disturb your sleep, come with numbness or swelling in the legs, or last longer than 10 minutes. 6, in red: one leg swollen, painful and red means see a doctor today; with chest pain or breathlessness call emergency services now.
What to do for a night cramp, from the NHS leg cramps and DVT pages. Do not stop prescribed medicines on your own.
Save image

04

Does magnesium help night leg cramps?

In the best evidence we have, not for older adults with unexplained cramps. The Cochrane review of magnesium for skeletal muscle cramps (Garrison and colleagues, 2020) pooled 11 trials with 735 people. Five trials enrolled women with leg cramps in pregnancy (408 people) and five enrolled people with idiopathic cramps, meaning cramps with no obvious underlying cause (271 people). Nearly all gave magnesium by mouth.

For idiopathic cramps, largely in older adults (mean age 61.6 to 69.3 years) with presumed night leg cramps, the differences between magnesium and placebo were small and not statistically significant. The number of cramps per week at four weeks differed by −0.18 (95% confidence interval −0.84 to 0.49; 5 studies, 307 people; moderate-certainty evidence). The share of people whose cramps fell by 25% or more was no different either: risk ratio 1.04 (95% confidence interval 0.84 to 1.29; 3 studies, 177 people; high-certainty evidence). A risk ratio of 1 would mean no difference, and both ranges include no difference. The authors concluded that it is unlikely that magnesium supplements provide clinically meaningful cramp prevention for older adults with muscle cramps.

The review cannot settle cramps in pregnancy: all five pregnancy trials were at high risk of bias, and the authors call the evidence conflicting and say more research is needed. If you are pregnant, ask your midwife or doctor before taking any supplement. The review found no trials of magnesium for cramps linked to exercise or to illnesses such as motor neurone disease, apart from one small, inconclusive study in people with liver cirrhosis, so it says little either way about those. The review also found that magnesium by mouth caused mostly stomach and bowel effects such as diarrhoea, in 11% (10% with placebo) to 37% (14% with placebo) of people, and in the 4 trials that reported it, minor side effects were reported more often with magnesium than with placebo, but the range includes no difference, so this is not a clear finding (risk ratio 1.51, 95% confidence interval 0.98 to 2.33; 4 studies, 254 people; low-certainty evidence). These side-effect figures pool all the trials, pregnancy included. MedlinePlus lists low magnesium, potassium or calcium among the causes of cramps; if a blood test finds a low level of any mineral, the doctor who ordered it decides what to do.

A chart of three risk ratios from the 2020 Cochrane review of magnesium for muscle cramps, each with its 95% confidence interval, and a line at 1 meaning no difference. Cramps cut by 25% or more: 1.04 (0.84 to 1.29). Cramps rated moderate or severe: 1.33 (0.81 to 2.21). Minor side effects in all trials, including pregnancy: 1.51 (0.98 to 2.33). All three bars cross or touch the line at 1, so none shows a clear difference from placebo. Cramps per week at 4 weeks: −0.18 (95% CI −0.84 to 0.49), 5 studies, 307 people. Pregnancy trials could not be pooled, and their results conflicted.
Cochrane 2020: magnesium versus placebo in people with unexplained cramps, mostly older adults. A bar that crosses 1 means no clear difference.
Save image

05

Could my medicines be causing night leg cramps?

They can. The NHS names statins and diuretics (water pills) as medicines that can cause leg cramps. Do not stop either on your own. The NHS says that if you stop taking statins your cholesterol levels may be affected, and to talk to a doctor or pharmacist before stopping; for atorvastatin it says to keep taking the medicine unless you are advised to stop, and that a pharmacist or doctor may be able to suggest ways to reduce side effects. The same caution applies to any medicine your doctor prescribed: ask the doctor or pharmacist before changing it.

Rarely, a statin can damage the muscles. The NHS says this can cause muscle cramps, severe pain and weakness, and you may also have a high temperature and red or brown urine. If you take a statin and think you might be having a serious side effect, get medical advice today, and tell them which medicine you take. Our statin side effects story explains what the trials show about ordinary muscle aches.

If stretching has not helped, the NHS says a doctor may suggest quinine tablets, which are not suitable for everyone; the doctor will discuss the risks and side effects with you. Do not take someone else's tablets.

06

Is it a cramp, or restless legs, poor circulation or something else?

A cramp is a sudden, tight, painful muscle that can make it hard to move the leg. Two lookalikes have their own guides. Restless legs syndrome is an urge to move the legs that peaks at rest; our restless legs guide explains it. Leg pain that comes on with walking and eases with rest can be a sign of narrowed leg arteries; see our peripheral artery disease guide.

Cramps can also go with other conditions. MedlinePlus says people with thyroid or nerve disorders are more likely to get them, and that when another medical problem is behind the cramps, treating that problem will likely help. The NHS says that a doctor will examine you to try to find the reason for your leg cramps and suggest treatment depending on the cause.

07

When should I see a doctor for leg cramps?

Book a visit if cramps disturb your sleep, come with numbness or swelling in your legs, or last longer than 10 minutes, which are the NHS reasons. MedlinePlus adds cramps that are severe, happen frequently, do not get better with stretching and drinking enough fluids, last a long time, or come with muscle weakness.

One leg that is swollen, painful and red, blue or darker in colour may be a blood clot (DVT), not a cramp; MedlinePlus also says to contact a provider if cramps come with swelling, redness or warmth. The NHS says to get urgent medical help for suspected DVT, and to call emergency services if pain and swelling come with chest pain or shortness of breath. Our DVT guide has the details.

Leg cramps: how fast to act

Emergency — act now

One leg is swollen and painful, and you also have chest pain or feel short of breath: call emergency services now. These can be signs that a clot has travelled to the lungs. Do not drive yourself.

Same-day — call promptly

One leg is swollen, painful, and red or darker in colour (a possible DVT, not a cramp), or you take a statin and have muscle cramps with severe pain or weakness, a high temperature, or red or brown urine: see a doctor today. Tell them which medicines you take, and do not stop a prescribed medicine on your own.

Routine — see a doctor

Cramps that disturb your sleep, come with numbness or swelling in the legs, last longer than 10 minutes, happen often, do not get better with stretching and drinking enough fluids, or come with muscle weakness: book a visit with your doctor.

Values mentioned in this story

Each one opens a visual guide with its normal range and what moves it — upload a report and we place your own numbers on the same scale.

Sources

Share this story

WhatsApp

Curious where your own values stand?

Two minutes from upload to a full visual picture. Free to analyze.

Analyze my report — free