Nighttime leg cramps can often be reduced or prevented with regular calf stretching, staying hydrated, and adjusting your sleeping position. About 8 to 11 percent of adults over 50 experience moderate to severe cramps on 15 or more nights per month, so if you’re dealing with this, you’re far from alone. The good news is that several simple strategies can make a real difference, and most of them cost nothing.
Why Cramps Happen at Night
The exact cause of nocturnal leg cramps isn’t fully settled, but the leading theory involves overactive nerve signals. Electromyographic studies show that cramps originate in the lower motor neurons, which fire rapid, involuntary bursts that force the muscle into a sustained contraction. During sleep, your foot naturally points downward, which puts your calf muscles in their most shortened position. In that already-compressed state, even a small burst of nerve activity can trigger a full cramp.
Muscle fatigue also plays a role. If you were on your feet more than usual during the day, or did a hard workout, your muscles may be more prone to misfiring at night. People with neurologic conditions like Parkinson’s disease experience cramps at higher rates, further supporting the nerve-dysfunction theory. Some researchers also point to modern lifestyles: we rarely squat deeply or stretch our calves and tendons the way humans historically did, leaving those muscles chronically tight.
What to Do During a Cramp
When a cramp strikes, your instinct is to grab your leg, and that instinct is partially right. The fastest relief comes from stretching the cramping muscle. For a calf cramp (the most common type), flex your foot so your toes pull toward your shin. You can do this by standing and pressing your heel into the floor, or by sitting in bed and pulling your toes back with your hand or a towel looped around your foot. Hold the stretch until the contraction releases, usually 15 to 30 seconds.
Walking on the affected leg can also help because it forces the calf to lengthen. Some people find that massaging the muscle or applying a warm towel speeds up the relaxation. Ice can help with the soreness that lingers afterward.
Stretching for Prevention
Daily calf stretching is the most consistently recommended prevention strategy. The Cleveland Clinic suggests a simple wall stretch: stand about three feet from a wall, lean forward with your arms outstretched and palms flat against the wall, and keep your feet flat on the floor. Hold for a count of five, then repeat for at least five minutes. Do this three times per day.
The timing of your last stretch matters. Doing a round right before bed is especially useful because it lengthens the calf fibers before you enter the sleeping position that shortens them. If three sessions a day feels like a lot, prioritize the bedtime stretch and add others when you can. Consistency over weeks tends to produce the best results, since you’re gradually retraining the muscle’s resting length and the nerve signals that control it.
Hydration and Electrolytes
Dehydration is one of the most commonly cited cramp triggers, particularly for people who don’t drink much water in the evening to avoid nighttime bathroom trips. The muscles and nerves that control them rely on adequate fluid and a balance of sodium, potassium, calcium, and magnesium to function properly. When fluid levels drop, nerve excitability can increase.
A practical approach is to drink water steadily throughout the day rather than trying to catch up at night. If you sweat heavily during exercise or live in a hot climate, replacing electrolytes (through foods or an electrolyte drink) becomes more important. Potassium-rich foods like bananas, potatoes, and leafy greens, along with calcium from dairy or fortified alternatives, can help maintain the mineral balance your muscles need.
Does Magnesium Actually Help?
Magnesium supplements are one of the most popular home remedies for leg cramps, but the evidence is disappointing. A Cochrane review combining five well-designed studies found that magnesium supplementation did not meaningfully reduce cramp frequency or severity in older adults compared to a placebo. The differences were small, not statistically significant, and consistent across trials.
Oral magnesium also caused gastrointestinal side effects like diarrhea in up to 37 percent of participants in some studies. That doesn’t mean magnesium is worthless for everyone. If you have a confirmed deficiency, correcting it could help. But for the average person with nighttime leg cramps and normal magnesium levels, supplements are unlikely to be the answer. The evidence is more conflicting for pregnant women experiencing cramps, where magnesium may still play a role.
Vitamin B Complex
One supplement with more promising (though limited) data is vitamin B complex. A study published in the journal Neurology found that a B complex supplement containing 30 mg of vitamin B6 per day led to cramp remission in 86 percent of treated patients who were not known to be vitamin deficient, compared to placebo. This was a small study of 28 people, so the results should be taken cautiously, but the American Academy of Neurology lists vitamin B complex as a treatment that “may be considered” for muscle cramps based on this evidence.
Sleep Position and Bedding
How you set up your bed can either encourage or discourage cramps. Heavy blankets and tightly tucked sheets push your feet into a pointed position, shortening the calf muscles all night. Loosening the sheets at the foot of the bed, or using a lighter blanket, gives your feet room to stay in a neutral position. Some people place a pillow at the foot of the bed to prop against, keeping their feet from dropping forward.
Sleeping on your back with tight covers is the worst combination for calf cramps. If you tend to sleep on your back, letting your feet hang slightly over the edge of the mattress or propping them with a rolled towel can help. Side sleepers generally have less trouble because the feet are less likely to be forced into full plantar flexion.
Why Quinine Is Not the Answer
Quinine, the compound found in tonic water, was once widely used for leg cramps. It does have some effect on muscle contractions, but the FDA has made clear that quinine is not considered safe or effective for treating or preventing leg cramps. It is approved only for treating malaria.
The risks are serious. Quinine can cause a dangerous drop in blood platelets, severe allergic reactions, and heart rhythm problems. Fatalities and kidney failure requiring dialysis have been reported. The FDA has required a boxed warning (the strongest type) on quinine products about these risks when the drug is used off-label for cramps. Even the small amount of quinine in tonic water is not enough to reliably prevent cramps, and drinking large quantities to try to get a therapeutic dose introduces unnecessary risk.
Cramps vs. Restless Legs Syndrome
Nighttime leg cramps and restless legs syndrome both strike at night and affect the lower limbs, but they feel very different. Cramps are sudden, painful, involuntary muscle contractions, most often in the calf. You can usually feel the muscle knotted up, and the pain is sharp and intense for seconds to minutes.
Restless legs syndrome, by contrast, causes a creeping, uncomfortable urge to move your legs. It’s not a contraction but a sensory discomfort that gets worse when you’re still and improves when you move. If your nighttime leg trouble feels more like restlessness or an internal itch than a hard, painful cramp, you may be dealing with restless legs syndrome, which has different causes and treatments.
Putting It All Together
The most effective approach combines several low-cost strategies. Stretch your calves for five minutes before bed every night. Stay well hydrated throughout the day. Loosen your sheets so your feet aren’t pushed into a pointed position. If cramps do strike, immediately flex your foot and stretch the muscle until it releases. A vitamin B complex supplement is a reasonable option to try, while magnesium is unlikely to help unless you have an actual deficiency. Avoid quinine in any form for cramp prevention.
Cramps that are very frequent, worsening, or accompanied by muscle weakness, swelling, or numbness may point to an underlying condition like nerve damage, circulation problems, or a medication side effect (statins and diuretics are common culprits). In those cases, the cramps themselves are a symptom worth investigating rather than just managing.

