Nocturnal leg cramps can often be stopped mid-cramp by standing up, stretching the affected muscle, or applying heat. For long-term prevention, a nightly stretching routine before bed is the most well-supported approach, reducing cramp frequency by about 35% in clinical trials. Beyond that, the picture gets more nuanced, with some popular remedies holding up better than others under scrutiny.
How to Stop a Cramp in Progress
When a cramp hits, your calf or foot muscle is locked in an involuntary contraction. The fastest way to break it is to counteract that contraction by stretching the muscle. For a calf cramp, flex your foot upward, pulling your toes toward your shin. If you’re in bed, simply standing up and putting weight on the cramping leg is often enough to release it.
Gentle massage also helps the muscle relax. Press into the knotted area and work it with your fingers until you feel it soften. Once the acute contraction passes, applying a heating pad or warm washcloth to the spot can ease the lingering soreness that sometimes follows a bad cramp. Ice is less helpful here because the problem is a muscle that won’t let go, and warmth encourages it to loosen.
Why Cramps Happen at Night
The root cause is abnormal firing of the motor nerves that control your muscles. Normally, your nervous system balances two types of signals: excitatory signals that tell a muscle to contract and inhibitory signals that tell it to relax. When you’re fatigued, dehydrated, or low on certain minerals, the inhibitory signals weaken, and your motor neurons keep firing without a proper “off switch.” The result is a sustained, involuntary contraction that can last from a few seconds to several minutes.
Several factors make nighttime especially cramp-prone. Your legs have been working all day, fatigue has built up in the muscles, and you’re lying still in positions that can subtly shorten the calf muscle for hours. Older adults are more susceptible because nerve function gradually changes with age, and muscle mass decreases, meaning the remaining muscle fibers are doing more work and fatiguing faster.
Stretching Before Bed Works
A clinical trial of 80 adults over age 55 tested a simple calf and hamstring stretching routine performed before sleep. After six weeks, the stretching group experienced about 1.2 fewer cramps per night compared to the control group, a 35% reduction in cramp frequency from their baseline. That’s a meaningful improvement for something that costs nothing and takes a few minutes.
The routine doesn’t need to be complicated. A standing calf stretch (leaning into a wall with one leg behind you, heel flat on the floor) held for 20 to 30 seconds on each side is the core movement. Adding a hamstring stretch, like placing your heel on a low step and leaning forward gently, covers the other major muscle group involved. Do these stretches nightly, and give it several weeks to see results.
Magnesium, Electrolytes, and What the Evidence Shows
Magnesium supplements are one of the most commonly recommended remedies for leg cramps, but the clinical evidence is disappointing. A randomized trial of 94 adults taking 520 mg of elemental magnesium daily at bedtime for four weeks found no significant difference between magnesium and a placebo. Both groups saw their cramps decrease, which likely reflects the placebo effect and the natural tendency of cramps to come and go in cycles.
The broader electrolyte picture is similarly complicated. The theory that low sodium, potassium, calcium, or magnesium triggers cramps makes intuitive sense, but controlled studies have struggled to confirm it. In one trial, participants who drank an electrolyte beverage actually cramped at a slightly higher rate (69%) than those who received no fluid at all (54%). That doesn’t mean electrolytes are irrelevant to muscle function, but it does suggest that simply loading up on sports drinks or mineral supplements isn’t a reliable fix for most people.
One supplement with more promising data is vitamin B complex. A small randomized, placebo-controlled study of 28 elderly patients with severe nocturnal cramps found that after three months, 86% of those taking a B-complex supplement experienced significant remission of their cramps, while the placebo group showed no meaningful change. The study was small, so it’s not definitive, but B vitamins play a direct role in nerve function, which makes the result biologically plausible.
Medications That Can Cause Cramps
If your cramps started or worsened after beginning a new medication, the drug itself may be a contributing factor. Three classes of medications have been linked to increased cramping: diuretics (water pills used for blood pressure), statins (cholesterol-lowering drugs), and long-acting inhaled bronchodilators used for asthma or COPD.
The strongest associations were with potassium-sparing diuretics and inhaled bronchodilators. People taking these medications were roughly twice as likely to need cramp treatment in the year after starting the drug. The link with statins and loop diuretics was weaker. If you suspect a medication connection, it’s worth raising with your prescriber, as adjusting the dose or switching to an alternative can sometimes resolve the problem.
Why Quinine Is Not the Answer
Quinine, found in tonic water and available by prescription, was once widely used for leg cramps. The FDA has explicitly warned against this. Quinine carries risks of serious blood disorders, including conditions that can cause uncontrolled bleeding or kidney failure requiring dialysis. Fatalities have been reported. Since 2006, the FDA has added a boxed warning to quinine labeling and issued multiple safety communications. It is approved only for treating malaria, not leg cramps.
Cramps vs. Restless Legs
Nocturnal leg cramps and restless leg syndrome both happen at night and both affect the legs, but they feel distinctly different. A cramp is a sudden, painful contraction, usually in the calf, that you can see and feel as a hard knot. Restless leg syndrome is an uncomfortable urge to move your legs, often described as crawling, tingling, or aching, and the sensation improves when you get up and walk around. If your nighttime leg discomfort is more of a restless, uncomfortable sensation than a sharp, seizing pain, you may be dealing with restless leg syndrome, which has different causes and treatments.
Signs That Need Medical Attention
Occasional leg cramps are common and harmless, but certain patterns warrant a closer look. Cramps that are severe and don’t resolve with stretching, cramps accompanied by muscle weakness or noticeable loss of muscle mass, and cramps that consistently disrupt your sleep to the point of daytime fatigue all justify a medical evaluation. If cramps began after exposure to a toxin, such as a pesticide or industrial chemical, seek care right away.

