Rheumatology, blood and immunity
Leg cramps: causes, treatment and how to stop them at night
Leg cramps are sudden, painful tightenings of a muscle, usually in the calf. They last from a few seconds to 10 minutes, are most common at night and are usually harmless. Stretching helps during a cramp, but magnesium is unlikely to prevent ordinary night cramps in older adults.

Contents
What are leg cramps?
In a cramp the muscle suddenly tightens, feels hard and cannot be relaxed at will. Besides the calf, it can affect the foot and thigh. Soreness can last up to 24 hours afterwards. Often no cause is found; doctors then call the cramps idiopathic.
The key point: a brief cramp that goes completely usually needs no treatment. Swelling, redness, weakness or pain that persists makes it something different.
Leg cramps at night
Most people get cramps at night or when resting. They are more common with age, after unaccustomed exercise and in later pregnancy.
If they wake you regularly, keep a short diary for two weeks: time, muscle, how many minutes it lasted, activity that day, alcohol and new medicines. Take it to your GP with a list of all medicines and supplements. This is often more useful than trying a supplement at random.
Common causes of leg cramps
- Muscle fatigue and overuse – unaccustomed exercise, especially in hot or humid weather; the most common cause.
- Dehydration – in hot weather, after vomiting or diarrhoea, or heavy sweating; see dehydration.
- Pregnancy – usually in the later stage.
- Low mineral levels – low potassium, magnesium or calcium, which a blood test can detect.
- Medicines – some diuretics (water tablets), statins for cholesterol and others; do not stop a medicine yourself – ask your doctor.
- Medical conditions – nerve damage (for example in diabetes), an underactive thyroid, kidney failure and dialysis, liver disease, a pinched nerve and narrowed arteries.
- Alcohol – alcohol use disorder and the liver disease it causes can lead to cramps.
Leg cramps in pregnancy and in children
In pregnancy cramps are common, especially at night. Gentle regular activity, ankle movements and stretching help. Take supplements only after talking to your midwife or doctor. New swelling and pain in one leg need same-day assessment because pregnancy raises the risk of a clot.
In children aged 3–12, evening pain in both legs that has gone by morning is often called "growing pains". The name is misleading: growing does not cause it. Book a doctor's appointment if pain is in one leg or one joint, comes in the morning or on walking, or there is a limp, rash, swelling, unusual bruising, tiredness or weight loss. Leg pain with a high temperature and feeling unwell, or a child who cannot bear weight, needs emergency care.
Cramp or something else?
| Condition | What sets it apart | How fast |
|---|---|---|
| Cramp | Sudden, hard muscle, gone in seconds to 10 minutes | No visit needed if occasional |
| Restless legs | Urge to move in the evening at rest, sometimes painful | GP appointment |
| Narrowed arteries | Cramp-like pain on walking that eases after a few minutes' rest | GP appointment |
| Nerve damage | Numbness, tingling, burning | GP appointment |
| Deep vein thrombosis | Constant pain and swelling, usually in one leg, colour change or warmth | Same-day assessment |
| Blocked artery | Suddenly cold, pale, numb or weak leg | Emergency services |
For frequent cramps, a GP will examine your legs, review your medicines and may check potassium, calcium, magnesium, kidney and thyroid function; other tests depend on your symptoms. Reference ranges vary by laboratory.
What to do during a cramp
- Stop the activity and straighten your leg.
- Pull your toes towards you to stretch the calf.
- Massage the muscle, or stand carefully and put weight on the leg.
- Heat can relax the tight muscle; ice through a cloth may ease soreness afterwards.
Painkillers work too slowly to stop the cramp itself. If the muscle stays sore, ask a pharmacist what suits you. If a cramp lasts more than 10 minutes, book an appointment; if the leg is swollen and the pain does not go, be seen the same day.
Treatment and prevention
Calf stretch recommended by the NHS:
- Face a wall with arms stretched out so your hands just touch it. Keep your feet flat on the floor.
- Lean forward until you feel your calves stretch.
- Hold for 2–3 seconds and stand up straight.
- Repeat for about 5 minutes, up to 3 times a day, the last time before bed. If cramps reduce, once or twice a day may be enough.
If you are unsteady or recently injured, ask a doctor or physiotherapist how to do it safely.
- Build up exercise gradually.
- Drink enough, especially in heat. With heart or kidney failure, keep to the amount your doctor has set.
- Cut down on alcohol.
If a disease or medicine is responsible, your doctor treats the cause or considers a change; do not stop medicines yourself. Quinine carries serious risks, is not suitable for everyone and is a decision for a doctor only if exercises have not helped.
Does magnesium help leg cramps?
A Cochrane review covers 11 trials of magnesium:
| Who | What the evidence shows |
|---|---|
| Older adults with ordinary cramps | Unlikely to reduce frequency or severity |
| Pregnancy | Conflicting results; benefit uncertain |
| Exercise cramps | No randomised trials in the review |
| Liver cirrhosis | One small trial, no difference in frequency |
Side effects are mainly diarrhoea and nausea. A proven deficiency is treated by a doctor as a deficiency. Do not take magnesium or potassium on your own with kidney disease, in pregnancy or alongside regular medicines. Pulses, nuts, leafy greens and bananas supply these minerals; with kidney disease, check potassium-rich foods with your doctor too.
When to see a doctor
Book a GP appointment if cramps are frequent or severe, disturb your sleep, last more than 10 minutes, do not respond to stretching, come with numbness or muscle weakness, or started after a new medicine. Cramp-like pain on walking that stops with rest can be peripheral arterial disease.
Same-day assessment: new swelling, warmth, colour change or constant pain in one calf – possible deep vein thrombosis. Risk is higher after surgery or immobility, on journeys over 4 hours and in pregnancy. See also swollen legs.
Call emergency services for breathlessness or chest pain together with leg swelling or pain, or for a suddenly cold, pale, numb or weak leg.
Frequently asked questions
Why do I get leg cramps at night?
Often no cause is found. Age, unaccustomed exercise, dehydration, pregnancy and some medicines play a part. Regular calf stretching may help.
Does magnesium stop leg cramps?
A Cochrane review found that it is unlikely to help older adults with ordinary cramps. Evidence in pregnancy is conflicting. If you have a proven deficiency, a doctor decides how to treat it.
How do I stop a calf cramp quickly?
Straighten your leg and pull your toes towards you, or stand and press your foot flat on the floor. Massage the muscle. The spasm usually passes within a few minutes.
Are leg cramps in pregnancy dangerous?
Usually not – they are common and harmless. New swelling and pain in one leg, however, need same-day assessment because of the risk of a clot. With breathlessness or chest pain, call emergency services.
What does it mean if I get cramps in my legs and hands?
They can be linked to exertion, dehydration, mineral imbalance, thyroid or kidney problems, or medicines. Book an appointment if they keep returning. Your doctor will decide which blood tests are needed.
Could calf pain be a blood clot?
Yes. Persistent pain with swelling, warmth or colour change in one calf should be checked the same day. With breathlessness or chest pain, call emergency services.
Sources
This article is for education and does not replace consultation, diagnosis or treatment by a doctor. In an emergency call emergency services.



