Hydration

Leg cramps at night: causes and what helps

By Gonçalo, founder of Rainu · Updated 18 October 2026 · 6 min read

Short answer: night leg cramps are very common, usually harmless, and most often have no clear cause. Tight calf muscles, low electrolytes, losing fluid through sweat, vomiting or diarrhea, some medicines, caffeine and late pregnancy can make them more likely. Stretch the calf to stop one. To prevent them, stretch before bed and drink enough, especially after exercise. Magnesium and quinine haven't been shown to work.

What is a leg cramp?

A sudden, brief, involuntary and usually painful tightening of a muscle. Cramps are common in healthy people, mostly in middle-aged and older adults. Sleep-related leg cramps usually hit the calf and foot, curling the foot and toes downward. MSD Manual, Muscle cramps (2025).

What causes leg cramps at night?

The most common type is benign leg cramps, which happen at night for no known reason. MSD Manual. Some things raise the odds:

MSD Manual.

Can dehydration cause muscle cramps?

It can play a part. Muscle cramps are on the list of signs of mild to moderate dehydration. MedlinePlus, Dehydration (2025). Losing fluid through sweat, vomiting or diarrhea also takes electrolytes with it, and low electrolytes make cramps more likely. That's why doctors suggest drinking plenty of fluids after exercise, particularly sports drinks that contain potassium. MSD Manual. But most night cramps have no known cause, so water alone isn't a guaranteed fix. Electrolytes explained → Signs of dehydration →

How to stop a leg cramp

Stretch the muscle. For a calf cramp, pull your foot and toes up toward you with your hand, or stand and do a runner's stretch. Massage can also help for a while. MSD Manual. Does pickle juice stop cramps? →

How to prevent leg cramps at night

MSD Manual.

Does magnesium help leg cramps?

Probably not. Most medicines and supplements prescribed to prevent cramps, including calcium supplements and magnesium carbonate, haven't proved effective, and they can have side effects. Quinine is no longer recommended for cramps because of side effects such as abnormal heart rhythms, vomiting, vision problems, ringing in the ears and headaches. MSD Manual. If a blood test shows your magnesium or potassium is actually low, that's different: your doctor will treat it.

Leg cramps in pregnancy

Electrolyte levels can drop late in pregnancy, which makes cramps more likely. MSD Manual. Stretching usually helps; ask your doctor or midwife before taking any supplement.

When to see a doctor

MSD Manual.

Questions

Why do I get leg cramps at night?

Often for no clear reason. Tight calves, low electrolytes, losing fluid, some medicines, caffeine and late pregnancy make them more likely.

Can dehydration cause leg cramps?

It can contribute: muscle cramps are a sign of mild to moderate dehydration, and losing fluid also means losing electrolytes. Drinking enough, especially after exercise, helps.

What stops a leg cramp fast?

Stretching the muscle: pull your foot and toes toward you, or stand and do a runner's stretch. Massage can help too.

Does magnesium stop leg cramps?

Supplements like magnesium carbonate haven't proved effective for preventing cramps, unless a test shows your magnesium is low.

Are leg cramps a sign of something serious?

Usually not. See a doctor if they come with weakness, numbness, twitching, cramps in the arms or trunk, or after heavy fluid loss.

Sources

General information, not medical advice. Cramps with sudden weakness, numbness, or after heavy vomiting, diarrhea or sweating need a doctor. Don't stop a prescribed medicine without asking.

Rainu app icon

Drink after you train

Rainu works out a daily goal from your weight, activity and the heat, and spreads gentle reminders through your day so you're not catching up all at once. Free on Google Play for Android and on the App Store for iPhone.