Leg Cramps at Night: Why They Happen and How to Stop Them
Leg cramps at night are sudden, painful tightenings of a muscle, usually the calf or foot, that last seconds to minutes and often wake you. They're very common, especially over age 50 and in pregnancy, and in most cases have no serious cause. To stop one, flex your foot (pull toes toward your shin) or stand and press your heel into the floor, then massage the muscle. Regular calf stretching before bed may reduce them for some people; evidence for magnesium in older adults is weak, and quinine is not recommended because of serious side effects.
How to stop a cramp right now
- Stretch the muscle. For a calf cramp, straighten your leg and pull your toes toward you, or stand and lean forward with the heel down.
- Walk around on the affected leg once it eases.
- Massage the knotted muscle firmly.
- Heat afterward (a warm towel or shower) for lingering soreness, or ice if it feels tender.
- For a foot cramp, pull your toes up and press the ball of your foot into the floor.
Soreness can last for hours after a strong cramp; that's normal.
Why night cramps happen
The exact cause is often unknown. The most likely explanation is a misfire in the nerves that control the muscle, especially in muscles kept in a shortened position for hours (lying with toes pointed under heavy blankets). Contributing factors:
| Factor | Why it matters |
|---|---|
| Age | Muscles and nerves change; cramps peak after 50 |
| Pregnancy | Common in the second and third trimesters |
| Prolonged sitting or standing | Muscle fatigue and shortening |
| Unaccustomed exercise | Overworked muscles cramp more |
| Dehydration, heavy sweating | Electrolyte shifts can contribute in some cases |
| Medications | Diuretics, statins, some asthma drugs and others |
| Medical conditions | Diabetes, kidney disease, thyroid problems, peripheral artery disease, nerve problems |
The American Family Physician review of nocturnal leg cramps notes most cases are idiopathic (no identifiable cause) and stresses checking medications and underlying conditions when cramps are frequent.
Prevention: what has evidence
- Calf stretching before bed. Some studies suggest a few minutes of calf and hamstring stretching nightly reduces cramp frequency and severity in older adults; others are mixed. It's low-risk and worth a try. A simple routine: wall calf stretch 3 × 30 seconds per leg, plus a hamstring stretch. See hamstring stretches and how long to hold a stretch.
- Loosen the covers so your toes aren't forced into a pointed position, or sleep with a pillow under your knees.
- Stay hydrated through the day, especially after sweaty exercise.
- Build exercise gradually and include calf work in a regular routine, building on a daily stretching routine.
- Review medicines with your doctor if cramps started after a new prescription.
A 5-minute bedtime routine
- Wall calf stretch, straight knee: 30 seconds per leg, twice.
- Wall calf stretch, bent knee (targets the deeper soleus): 30 seconds per leg.
- Seated hamstring stretch with a towel around the foot: 30 seconds per leg.
- Ankle circles and toe pulls: 10 each direction.
- Set up the bed: loosen tucked-in sheets and place a pillow under the knees or at the foot of the bed to keep ankles neutral.
Do it nightly for three weeks and keep a simple tally of cramp nights. If nothing changes, the tally is useful information for your doctor.
Popular remedies: do they work?
- Magnesium: A Cochrane review found it's unlikely to help typical leg cramps in older adults. Evidence in pregnancy is mixed.
- Potassium or bananas: helpful only if you're actually low, which is uncommon in healthy people eating normally.
- Pickle juice: small studies found it may shorten exercise-induced cramps, possibly via a reflex triggered in the mouth. Not well studied for night cramps.
- Quinine (tonic water or pills): the FDA warns against quinine for leg cramps because of rare but serious blood and heart side effects. Tonic water contains far too little to work anyway.
- Vitamin B complex, vitamin E: limited evidence.
Cramps during or after exercise
Exercise-associated muscle cramps are a related but slightly different problem. They usually strike late in long or intense sessions, especially in heat or when you've pushed harder than usual. Current thinking favors neuromuscular fatigue, the nerve-muscle control breaking down in tired muscles, as the main driver, with dehydration and salt loss contributing in some athletes.
What helps:
- Pace and progress training so muscles aren't pushed far beyond what they're used to.
- Fuel and hydrate for sessions longer than an hour, including some sodium in hot weather.
- Stretch the cramping muscle immediately and gently.
- Strengthen the muscles that cramp, such as calves, with regular calf raises; fitter muscles fatigue less.
Cramps in pregnancy
Leg cramps affect many pregnant people, especially at night in the second and third trimesters. Gentle calf stretching before bed, staying active during the day, staying hydrated and changing positions often can help. Some studies suggest magnesium may help in pregnancy, but results are inconsistent, so ask your prenatal care provider before taking any supplement.
Older adults
Night cramps become more common with age and can disturb sleep for months. Beyond stretching, it's worth reviewing medicines with a pharmacist, since diuretics and some other drugs are frequent contributors. Regular walking and calf strengthening may also help.
Leg cramps vs restless legs
Cramps are painful and the muscle visibly tightens. Restless legs are an urge to move with uncomfortable sensations, relieved by moving, without the hard knot. If that sounds more like you, read restless legs at night.
When to see a doctor
- Cramps that are frequent, severe or disrupt sleep regularly
- Muscle weakness, wasting or numbness
- Leg swelling, redness or warmth (possible blood clot: seek care promptly)
- Cramping pain when walking that eases with rest (possible circulation problem)
- Cramps that started with a new medication
Frequently asked questions
What causes leg cramps at night?
Often there's no clear cause. Age, pregnancy, muscle fatigue, prolonged sitting, dehydration, certain medications and conditions like diabetes or kidney disease can all contribute.
How do I stop a leg cramp fast?
Stretch the muscle by pulling your toes toward your shin or standing with your heel down, then massage and walk it off.
Does magnesium help leg cramps?
Research suggests magnesium is unlikely to help typical night cramps in older adults. It may help some pregnant women, but evidence is mixed.
Can dehydration cause leg cramps?
It can contribute, especially after heavy sweating, but many people with night cramps are not dehydrated.
Are night leg cramps a sign of something serious?
Usually not. See a doctor if they are frequent, come with weakness or numbness, or if your leg is swollen, red or warm.
Medical disclaimer: This article is for general educational purposes only and is not medical advice, diagnosis, or treatment. Talk with a qualified healthcare professional before changing your diet, exercise, sleep, or mental-health routine—especially if you have a health condition, take medication, are pregnant, or are recovering from injury. Stop exercising and seek care if you feel chest pain, severe shortness of breath, dizziness, or sharp joint pain.