Nighttime leg cramps affect 37 to 50% of older adults, and they’re common at younger ages too. The good news is that a combination of in-the-moment techniques and daily habits can significantly reduce how often they happen and how much they hurt. Here’s what actually works.
What to Do When a Cramp Strikes
When a cramp jolts you awake, your calf muscle is locked in an involuntary contraction. The fastest way to stop it is to stretch that muscle by pulling your toes and foot upward toward your shin. You can do this by grabbing your toes with your hand, or by standing and pressing your heel flat into the floor while leaning forward. The stretch forces the contracted muscle to lengthen, which interrupts the spasm.
Walking around for a few minutes after the cramp releases helps restore normal blood flow and prevents the muscle from seizing again. If the area stays sore afterward (which is normal), applying a warm towel or heating pad to the calf can ease the residual ache. Some people find that massaging the knotted area with firm pressure while the cramp is happening also shortens its duration.
Stretch Before Bed to Prevent Cramps
A randomized trial of older adults found that stretching the calf and hamstring muscles every night, immediately before bed, reduced both the frequency and severity of nocturnal leg cramps over six weeks. The routine doesn’t need to be complicated. Two stretches are the core of it:
- Calf stretch: Stand facing a wall with one foot about two feet behind the other. Keep the back heel on the ground and lean into the wall until you feel a pull in the back calf. Hold for 30 seconds, then switch legs.
- Hamstring stretch: Sit on the edge of your bed with one leg extended straight. Lean forward gently from the hips until you feel the stretch along the back of your thigh. Hold for 30 seconds per side.
Consistency matters more than intensity. The benefit in the trial came from doing these stretches nightly for at least six weeks, not from aggressive or prolonged stretching sessions.
Stay Hydrated, but Know Its Limits
Dehydration is often cited as the main cause of muscle cramps, but the relationship is more complicated than most people think. In one controlled study, 69% of subjects still experienced muscle cramps even when they were fully hydrated and supplemented with electrolytes. That said, dehydration clearly contributes in some people, especially those who sweat heavily, drink alcohol in the evening, or take medications that increase fluid loss.
A practical approach is to drink water steadily throughout the day rather than trying to catch up at night (which just means more bathroom trips). If you exercise or sweat during the day, replacing lost sodium and potassium matters. Sweat contains roughly 920 to 2,300 mg of sodium per liter and 120 to 160 mg of potassium per liter. Foods like bananas, potatoes, yogurt, and leafy greens cover the potassium side. A pinch of salt added to water or a meal can help replace sodium if you’ve been sweating significantly.
Does Magnesium Actually Help?
Magnesium supplements are one of the most popular recommendations for leg cramps, but the clinical evidence is disappointing. A well-designed randomized trial published in JAMA Internal Medicine tested 520 mg of elemental magnesium taken at bedtime and found it was not significantly more effective than a placebo at reducing nighttime leg cramps. That’s a high dose, and it still didn’t outperform a sugar pill.
This doesn’t mean magnesium is worthless for everyone. If you have a genuine magnesium deficiency (common in people who eat few vegetables, take certain medications, or have digestive conditions), correcting that deficiency could help. But buying magnesium supplements as a standalone cramp remedy is unlikely to solve the problem for most people.
Medications That Cause Leg Cramps
If your nighttime cramps started or worsened after beginning a new medication, the drug itself may be the trigger. Three classes of medications have the strongest links to nocturnal leg cramps:
- Long-acting inhaled bronchodilators (used for asthma and COPD) carry the highest risk. People who start these inhalers are roughly 2.4 times more likely to develop cramps requiring treatment.
- Diuretics (water pills for blood pressure or swelling) are the next biggest culprit, particularly potassium-sparing and thiazide types. These alter your electrolyte balance, which can make muscles more excitable.
- Statins (cholesterol-lowering drugs) have a smaller but real association with increased cramps.
Other medications linked to leg cramps include certain antidepressants, anti-seizure drugs, sleep aids, and estrogen-based hormone therapies. If you suspect a medication connection, it’s worth discussing alternatives or timing adjustments with your prescriber. Don’t stop a prescribed medication on your own.
Lifestyle Habits That Make a Difference
Beyond stretching and hydration, a few daily habits can lower your cramp frequency. Wearing shoes with good support during the day reduces calf fatigue that can trigger cramps hours later. If you sit or stand in one position for long periods, your muscles are more prone to cramping at night, so changing positions regularly and taking short walks throughout the day helps.
Keeping bed sheets and blankets loose around your feet also matters more than people realize. Tight or tucked-in sheets push your toes downward, which shortens the calf muscle and makes it more likely to spasm. Sleeping with untucked sheets, or on your back with a pillow propping your feet up slightly, keeps the calf in a more neutral position.
Alcohol and caffeine both promote fluid loss and can interfere with electrolyte balance, so reducing intake of either, particularly in the evening, is a straightforward adjustment that helps some people.
Skip the Quinine
Quinine, the bitter compound in tonic water, was once widely used for leg cramps. The FDA has explicitly warned against this. Quinine is approved only for treating malaria and is not considered safe or effective for leg cramps. It carries risks of serious blood disorders, kidney failure requiring dialysis, dangerous heart rhythm changes, and severe allergic reactions. Fatalities have been reported. The amount of quinine in a glass of tonic water is much lower than a medicinal dose, but the FDA remains concerned because adverse events continue to be reported even with casual use.
When Cramps Signal Something Else
Most nighttime leg cramps are harmless, if painful. But cramps that happen alongside other symptoms can point to an underlying condition worth investigating. Peripheral artery disease, which involves narrowed blood vessels in the legs, causes leg pain during walking that goes away with rest. Physical signs include hair loss on the legs, smooth or shiny skin, skin that feels cool to the touch, weak or absent pulses in the feet, and sores on the legs or feet that heal slowly.
It’s also helpful to know the difference between leg cramps and restless legs syndrome, since people sometimes confuse them. Nocturnal leg cramps involve sudden, painful muscle contractions, usually in the calf, that lock the muscle in a hard knot. Restless legs syndrome is a creeping discomfort or irresistible urge to move the legs that occurs at rest, particularly in the evening. It’s uncomfortable but not painful in the sharp, cramping sense. The distinction matters because the treatments are completely different.
Cramps that happen every night, don’t improve with stretching and hydration over several weeks, or come with muscle weakness, numbness, or swelling are worth bringing up with a doctor to rule out nerve damage, circulation problems, or electrolyte disorders.

