How to Prevent Leg Cramps: Stretches, Diet & Habits

Most leg cramps can be prevented with a combination of regular stretching, adequate hydration, and attention to your mineral intake. The cramps themselves are involuntary muscle contractions, most commonly in the calves, that strike without warning and can last from a few seconds to several minutes. While they’re rarely a sign of something serious, they’re painful enough that prevention is well worth the effort.

Daily Calf Stretches

Stretching is the single most reliable way to reduce how often leg cramps occur, especially the kind that wake you up at night. The Cleveland Clinic recommends a specific wall stretch: stand about three feet from a wall, lean forward with your arms outstretched against it, and keep both feet flat on the floor. Hold for a count of five, release, and repeat for at least five minutes. Do this three times a day.

The stretch works by lengthening the calf muscle and its tendon over time, which reduces the spontaneous contractions that cause cramping. If your cramps tend to hit at night, doing one of your three sessions right before bed can be especially helpful. You don’t need to stretch aggressively. Gentle, sustained holds are more effective than bouncing or forcing the muscle into position.

How Much Water You Actually Need

Dehydration makes muscles more excitable and prone to cramping. When your body’s fluid levels drop, the nerve signals that control muscle contraction become less stable, and your muscles are more likely to fire on their own.

A useful formula for daily water intake: multiply your body weight in pounds by 0.67 to get the number of ounces you should drink per day. If you weigh 160 pounds, that’s roughly 107 ounces, or about 13 cups. For every 30 minutes of exercise, add another 12 ounces on top of that. Hot weather, alcohol, and caffeine all increase your fluid needs beyond this baseline.

You don’t need to hit the number precisely. The goal is consistent hydration throughout the day rather than drinking large amounts at once. If your urine is pale yellow, you’re likely in good shape.

The Magnesium Question

Magnesium is the supplement most people reach for when cramps become a regular problem, but the evidence is more complicated than the marketing suggests. Multiple clinical trials have tested magnesium supplements against a placebo, and the short-term results are underwhelming. A review of five studies with over 300 participants found no meaningful difference in cramp frequency after four weeks of supplementation. A separate analysis of pregnant women, who are especially prone to leg cramps, also found no benefit from magnesium.

There is one encouraging finding, though. A trial of 184 adults taking 226 mg of magnesium oxide daily showed no significant improvement at 30 days, but by 60 days, the magnesium group experienced notably fewer cramps (about 1.9 per week, down from 5.4) compared to the placebo group (3.7 per week, down from 6.4). Cramp duration also dropped significantly. This suggests magnesium may help, but only if you stick with it for at least two months.

Whether or not you supplement, make sure you’re getting enough magnesium from food. The recommended daily amount is 420 mg for men and 320 mg for women over 31. Good sources include nuts, seeds, leafy greens, beans, and whole grains. If you do supplement, the tolerable upper limit from supplements alone is 350 mg per day for adults. Taking more can cause diarrhea and digestive upset.

Other Nutrients That Matter

Potassium and sodium work alongside magnesium to regulate muscle contraction. When any of these minerals drops too low, your muscles lose the electrical stability they need to relax properly after contracting. Bananas get all the credit for potassium, but potatoes, sweet potatoes, beans, and yogurt actually contain more per serving.

There’s also some evidence for B vitamins. A small study found that a vitamin B complex containing 30 mg of B6 daily induced remission of muscle cramps in 86% of treated patients who weren’t deficient in B vitamins to begin with. This was a single study with only 28 participants, so the evidence isn’t strong, but it earned a “possibly effective” rating in a review published in the journal Neurology. If your diet is low in whole grains, meat, or eggs, a B vitamin deficiency could be contributing to your cramps.

Exercise-Related Cramps

Cramps during or right after exercise have a different trigger than nighttime cramps. The leading explanation involves your nervous system rather than dehydration alone. During prolonged or intense exercise, the signals that tell a muscle to contract can overwhelm the signals that tell it to relax. This creates a feedback loop where the muscle keeps firing involuntarily. People who are prone to exercise cramps tend to have a lower threshold for this kind of nerve-driven contraction, which may be partly inherited.

To reduce exercise-related cramps, avoid sudden jumps in training intensity or duration. Cramps are far more common when a muscle is fatigued beyond what it’s conditioned for. Gradually building your training load gives your neuromuscular system time to adapt. Staying hydrated and replacing electrolytes during long workouts also helps, though it may not be sufficient on its own if the root cause is neuromuscular fatigue.

What to Do During a Cramp

When a cramp strikes, gently stretch the affected muscle and hold the stretch until the contraction releases. For a calf cramp, flex your foot upward by pulling your toes toward your shin. You can also stand and press your heel into the floor. Massaging the muscle or applying a warm towel can help it relax faster. Walking around slowly once the worst of the spasm passes encourages blood flow and helps prevent a second cramp in the same spot.

Why Quinine Is Not Worth the Risk

Quinine, a compound found in tonic water and available in prescription form, was once widely used for leg cramps. The FDA has made clear that quinine is not considered safe or effective for this purpose. It is approved only for treating malaria. The risks include a dangerous drop in platelet count, severe allergic reactions, and heart rhythm abnormalities. Deaths and kidney failure requiring dialysis have been reported. The amount of quinine in commercial tonic water is much lower than a therapeutic dose, but relying on it for cramp prevention is neither effective nor advisable.

Habits That Reduce Cramp Frequency

Beyond stretching, hydration, and nutrition, a few practical habits make a difference:

  • Loosen your bedding. Tight sheets and heavy blankets can push your feet downward, keeping your calf muscles in a shortened position all night. Untucking the sheets at the foot of the bed gives your feet room to stay in a neutral position.
  • Wear supportive shoes. Flat, unsupportive footwear forces your calf muscles to work harder throughout the day, increasing fatigue that can trigger nighttime cramps.
  • Move throughout the day. Prolonged sitting or standing in one position reduces blood flow to your legs. If you have a desk job, take short walking breaks every hour.
  • Warm up before activity. Cold muscles cramp more easily. A few minutes of light movement before exercise or physical work prepares your muscles for the demands ahead.