How to Prevent Charley Horses in Your Legs

Charley horses are sudden, involuntary muscle contractions that most often strike the calves, though they can hit the thighs or feet too. Preventing them comes down to a handful of daily habits: staying hydrated with electrolyte-rich fluids, stretching before bed, addressing nutritional gaps, and avoiding positions that keep your calf muscles shortened. Most people who get recurring leg cramps can reduce their frequency significantly without medication.

Why Charley Horses Happen

A charley horse starts when motor neurons in the spinal cord become hyperexcitable and lock into a self-sustaining feedback loop. Normally, a nerve signals your muscle to contract, then the signal stops and the muscle relaxes. During a cramp, the nerve keeps firing even after the initial trigger is gone. Sensory inputs from the muscle feed back to the motor neurons, which amplify the signal further, creating a loop that sustains the painful contraction for seconds to minutes.

Several things can set off this feedback loop: muscle fatigue, dehydration, electrolyte imbalances, prolonged muscle shortening (like sleeping with toes pointed), and certain medications. The cramp itself is your nervous system misfiring, not a problem with the muscle tissue. That’s why prevention strategies focus on calming nerve excitability and keeping muscles in a relaxed, lengthened state.

Hydrate With Electrolytes, Not Just Water

Dehydration is one of the most common cramp triggers, but drinking plain water after heavy sweating can actually make your muscles more susceptible to cramping. Research from BMJ Open Sport & Exercise Medicine found that when dehydrated participants drank plain water to replace what they’d lost through sweat, their muscles became easier to cramp in the 30 to 60 minutes afterward. Participants who instead drank a fluid containing sodium, potassium, chloride, and glucose (similar to an oral rehydration solution) saw no increase in cramp susceptibility.

The takeaway: water alone dilutes the electrolytes in your blood without replacing what you lost. If you sweat heavily from exercise, hot weather, or physical labor, add an electrolyte drink or mix a pinch of salt into your water. For everyday prevention, eating potassium-rich foods like bananas, potatoes, and leafy greens, along with adequate salt intake, helps maintain the mineral balance your nerves need to function properly.

Stretch Your Calves and Hamstrings Before Bed

If your cramps tend to strike at night, a simple stretching routine before bed is one of the most effective prevention strategies available. A randomized trial in older adults found that performing calf and hamstring stretches nightly, immediately before sleep, for six weeks significantly reduced both the frequency and severity of nocturnal leg cramps.

The routine doesn’t need to be complicated. A basic wall calf stretch works well: stand facing a wall, step one foot back, keep that heel flat on the floor, and lean forward until you feel a stretch in the back calf. Hold for 20 to 30 seconds, then switch legs. For the hamstrings, sit on the floor with one leg extended and reach toward your toes. Do both stretches on each leg before getting into bed. The goal is to lengthen the muscles so they’re less likely to fire into that self-sustaining contraction loop while you sleep.

Adjust Your Sleep Position

The way your feet sit while you sleep plays a role in nighttime cramps. When your toes point downward (a position called plantar flexion), your calf muscles stay shortened for hours, which can trigger spontaneous contractions. If you sleep on your back, try keeping your toes pointed toward the ceiling. A pillow or bolster under your calves can help. If you sleep on your stomach, let your feet hang off the end of the bed so gravity pulls your toes into a neutral position rather than pressing them into the mattress.

Heavy blankets can also push your feet into a pointed position. Loosening the sheets at the foot of the bed, or using a lighter blanket, gives your feet room to stay in a more natural posture overnight.

Consider Vitamin B Complex

Magnesium supplements are widely recommended for leg cramps, but the evidence is surprisingly weak. A Cochrane Review analyzing multiple studies found that oral magnesium supplementation (ranging from 100 to 520 mg daily) did not significantly reduce cramp frequency compared to placebo. The reviewers concluded that magnesium is unlikely to be effective for general muscle cramps at any tested dose.

Vitamin B complex, on the other hand, showed more promising results. In a randomized, double-blind, placebo-controlled trial of elderly patients with high blood pressure and nocturnal leg cramps, 86% of those taking a vitamin B complex experienced prominent remission of their cramps after three months. The placebo group saw no meaningful change. The supplement reduced cramp frequency, intensity, and duration. While this is a single study, the safety profile of B vitamins is well established, making it a low-risk option worth trying.

Check Your Medications

Certain prescription drugs are known to increase cramp frequency. A large study published in JAMA Internal Medicine identified three medication classes most strongly linked to nocturnal leg cramps:

  • Inhaled long-acting bronchodilators (LABAs): Used for asthma and COPD, these showed the strongest association. People using these inhalers, especially combination inhalers with corticosteroids, were roughly 2.5 times more likely to develop cramps.
  • Diuretics: Water pills, particularly potassium-sparing and thiazide types, nearly doubled cramp risk. These medications alter your body’s electrolyte balance, which directly affects nerve excitability.
  • Statins: Cholesterol-lowering statins showed a smaller but statistically significant association with cramps.

Over 60% of people seeking treatment for cramps in the study were taking at least one of these medications. If you take any of these and experience frequent cramps, it’s worth discussing alternatives or dose adjustments with your prescriber. Don’t stop any medication on your own.

Who Gets Cramps Most Often

Certain groups are more prone to charley horses. Older adults experience them more frequently because of natural muscle loss and changes in nerve function with age. Pregnant women are especially vulnerable, particularly in the third trimester. Risk increases with each additional week of pregnancy, with each prior pregnancy, and in women who have leg swelling or gastrointestinal issues. People who stand for long periods, athletes who train intensely, and anyone who is chronically dehydrated also face higher risk.

If you fall into one of these groups, the prevention strategies above become even more important. Pregnant women in particular benefit from nightly calf stretches and maintaining good electrolyte intake throughout the day.

Avoid Quinine for Cramps

Quinine, once commonly prescribed for leg cramps, carries serious risks that far outweigh any benefit. The FDA has issued multiple safety warnings stating that quinine (brand name Qualaquin) should not be used for nighttime leg cramps. It is only approved for treating malaria, yet the majority of prescriptions in the U.S. have historically been written for cramps.

The dangers are real: an FDA review found 38 serious adverse events over a three-and-a-half-year period, including 21 hospitalizations for severely low platelet counts (which causes dangerous bleeding) and two deaths. Other reported effects included cardiovascular events, hearing loss, and kidney damage. If a provider suggests quinine for your cramps, ask about the alternatives discussed above.

When Leg Pain Isn’t a Cramp

Most charley horses are harmless, but leg pain that doesn’t behave like a typical cramp deserves attention. A deep vein thrombosis (blood clot) can mimic cramp-like pain in the calf but comes with different features: swelling in one leg, skin that looks red or purple, warmth over the affected area, and soreness that persists rather than coming and going. Some blood clots cause no symptoms at all.

The critical warning signs come if a clot breaks loose and travels to the lungs. Sudden shortness of breath, chest pain that worsens when you breathe deeply, a rapid pulse, dizziness, or coughing up blood are signs of a pulmonary embolism and require emergency care. If your leg pain is accompanied by visible swelling, skin color changes, or persistent warmth in one leg, get it evaluated rather than assuming it’s just another charley horse.