What Actually Works for Leg Cramps at Night

Stretching your calf muscles before bed is the single most reliable way to reduce nighttime leg cramps. Between 50 and 60 percent of adults experience these cramps, so if you’re waking up with a painful, rock-hard calf muscle, you’re far from alone. The good news is that several simple, no-cost strategies can make a real difference, and understanding why cramps happen helps you pick the right ones.

Why Leg Cramps Happen at Night

The exact mechanism behind nocturnal leg cramps isn’t fully settled, but the leading explanation points to muscle fatigue and nerve dysfunction rather than a simple mineral deficiency. Electrical studies of cramping muscles show bursts of high-frequency nerve firing in the lower motor neurons, essentially your nerves sending rapid, involuntary “contract” signals to the muscle.

Sleep position plays a role too. When you lie in bed, your foot naturally points downward, which puts your calf muscle in a fully shortened position. A muscle that’s already compressed is primed to cramp when a stray nerve signal hits it. This is why cramps tend to strike the calves more than any other muscle group, and why they happen at night rather than during the day when your foot is flexed in different positions.

How to Stop a Cramp in Progress

When a cramp wakes you up, your instinct may be to grab your calf, but stretching the muscle is far more effective. Sit up, straighten your leg, and pull your toes back toward your knee. If you can reach, place a rolled towel under the ball of your foot, hold both ends, and gently pull toward you while keeping your knee straight. This forces the calf muscle to lengthen, which overrides the involuntary contraction.

Standing on the cramping leg and pressing your heel flat to the floor does the same thing. Some people find that walking around for a minute or two helps the muscle relax fully. After the cramp passes, the area may feel sore for hours or even into the next day, which is normal.

Nightly Stretching to Prevent Cramps

A consistent stretching routine before bed is the best-supported preventive measure. The stretch itself is simple: stand about two feet from a wall, place both hands on it, and step one foot back while keeping that heel on the ground. Lean forward until you feel a pull in your back calf. Hold for 20 to 30 seconds, then switch legs. Repeat two or three times on each side.

The goal is to keep your calf muscles from starting the night in a shortened, tension-loaded state. Daily stretching, especially right before you get into bed, relaxes the muscle fibers and may reduce the nerve irritability that triggers cramps. This is also worth doing before and after exercise if you’re physically active during the day.

Hydration and Electrolytes

Dehydration is one of the most commonly cited remedies online, and there’s reasonable logic behind it. Electrolyte imbalances, particularly low sodium or potassium, are associated with muscle cramping. Adding a small amount of salt to drinking water has been shown to reduce cramping rates in some cases. But more isn’t necessarily better: excessive water intake can dilute your sodium levels, and unsupervised potassium supplements carry a real risk of toxicity.

A practical approach is to make sure you’re drinking enough water throughout the day (not just at bedtime, which mostly creates bathroom trips) and eating potassium-rich foods like bananas, potatoes, and leafy greens. If your diet is reasonably balanced and you’re staying hydrated, adding electrolyte supplements is unlikely to make a dramatic difference for most people.

Does Magnesium Actually Help?

Magnesium is probably the most popular supplement recommendation for leg cramps, but the clinical evidence is surprisingly weak. A well-designed randomized trial testing magnesium oxide for nocturnal leg cramps was terminated early for futility, meaning the data showed it was not outperforming a placebo. The results were published in JAMA Internal Medicine in 2017 and remain one of the most rigorous tests of this approach.

That doesn’t mean magnesium is worthless for everyone. If you’re genuinely deficient (common in older adults, people taking certain medications, or those with poor diets), correcting that deficiency could help. But for the average person with idiopathic nighttime cramps, magnesium tablets are unlikely to be the fix.

B Vitamins: A Lesser-Known Option

There’s limited but intriguing evidence for B-vitamin supplementation. A clinical study of 28 patients found that a vitamin B complex (containing 30 mg per day of vitamin B6) led to cramp remission in 86 percent of treated patients compared to placebo, even among people who weren’t known to be vitamin deficient. This is a small study, so it’s not definitive, but it’s one of the more promising supplement findings in the cramp literature. A standard B-complex vitamin is inexpensive and low-risk, making it a reasonable thing to try.

Sleep Position and Bedding Adjustments

Since the resting position of your foot contributes to cramps, small changes to your sleep setup can help. Keeping blankets loose at the foot of the bed prevents them from pressing your feet into a pointed position. Some people sleep with a pillow propping up their feet, or hang their feet off the edge of the mattress to keep the ankle in a neutral angle. Sleeping on your back with heavy blankets tucked tightly is the worst-case scenario for calf cramps, because it locks your foot into exactly the position that pre-loads the muscle for a spasm.

Medications That Can Cause Cramps

If your cramps started or worsened after beginning a new medication, the drug itself may be the trigger. Several common medication classes list leg cramps as a side effect, including statins (used for cholesterol), diuretics (water pills), certain antidepressants, sleep aids, and some nerve pain medications. Chemotherapy drugs can also cause nerve damage that leads to cramping. If you suspect a medication link, that conversation with your prescriber is worth having, because a dosage adjustment or switch could solve the problem entirely.

Cramps vs. Restless Legs Syndrome

Nighttime leg cramps and restless legs syndrome both disrupt sleep, but they’re different conditions. Cramps involve a sudden, painful, involuntary muscle contraction that locks the muscle for seconds to minutes. Restless legs syndrome is an uncomfortable urge to move your legs, typically not painful, that occurs when you’re trying to fall asleep. Restless legs symptoms also tend to last much longer than a cramp episode. If your primary experience is an aching, crawling sensation relieved by movement rather than a hard knot in your calf, restless legs syndrome is the more likely explanation.

Why Quinine Is Not the Answer

Quinine, found in tonic water and once widely prescribed for cramps, is no longer considered safe for this purpose. The FDA has explicitly stated that quinine is not safe or effective for treating leg cramps. It carries risks of serious blood disorders, life-threatening allergic reactions, and dangerous heart rhythm changes. Fatalities have been reported. The only approved use for quinine is treating malaria. Drinking small amounts of tonic water (which contains very little quinine) is unlikely to cause harm, but it’s also unlikely to do much for your cramps.

For most people, the combination of nightly calf stretches, adequate hydration, loose bedding, and possibly a B-complex vitamin is enough to significantly reduce cramp frequency. If cramps persist despite these measures, or if they’re happening in unusual locations or accompanied by muscle weakness, that pattern warrants medical evaluation to rule out underlying nerve or vascular issues.