What to Do When Your Leg Cramps: Relief & Prevention

When a leg cramp strikes, the fastest way to stop it is to stretch the cramping muscle by pulling it in the opposite direction of the contraction. For a calf cramp, the most common type, that means flexing your foot so your toes point toward your shin. For a thigh cramp, bend your knee and pull your foot up toward your buttock. Hold the stretch until the spasm releases, then gently massage the area. Most cramps resolve within a few minutes using these techniques.

How to Stop a Cramp in the Moment

Your instinct during a cramp might be to grab the muscle and freeze, but movement is your best tool. Start by straightening the affected leg and flexing it, pulling your toes toward your shin to lengthen the cramping calf muscle. If you can stand, press your feet flat against the floor, which forces the muscle out of its contracted position. Walking around and gently wiggling the leg also helps the muscle fibers reset.

Once the worst of the spasm passes, massage the area with your hands or a foam roller. This increases blood flow to the muscle and helps it relax fully. You can follow up with either heat or cold, depending on what feels better. A heating pad or warm bath tends to loosen the residual tightness, while an ice pack wrapped in a towel can reduce any lingering soreness. After the cramp subsides, elevating the leg for a few minutes helps with recovery.

Why Leg Cramps Happen

There are two leading explanations for why muscles cramp, and the real answer for any individual cramp is probably some combination of both.

The first is dehydration and electrolyte imbalance. Sodium and potassium are essential for muscles to contract and relax properly. When you lose fluid and electrolytes through sweating, illness, or simply not drinking enough, the nerve endings near your muscles become more sensitive and the space between muscle cells shrinks. That combination makes involuntary contractions more likely.

The second explanation is neuromuscular fatigue. When a muscle is overworked or held in a shortened position for too long, the communication system between your nerves and muscle fibers glitches. The signals telling the muscle to contract ramp up while the signals telling it to relax drop off. This is why cramps often hit near the end of a long run or after hours of sitting in an awkward position, not at the beginning.

Preventing Cramps Before They Start

Staying hydrated is the simplest preventive measure. General recommendations call for roughly 16 cups of fluid per day for men and 12 cups for women, though you’ll need more if you’re exercising, in hot weather, or sweating heavily. Plain water handles most of your needs, but if you’re doing prolonged or intense exercise, a drink with sodium and potassium helps replace what you lose in sweat.

Regular stretching makes a noticeable difference, especially for people who get cramps at night. Stretching your calves, hamstrings, and quadriceps for a few minutes before bed keeps those muscles lengthened and less prone to spontaneous contraction. If nighttime cramps are a recurring problem, check your sleeping setup: heavy blankets or tucked-in sheets can push your feet into a pointed position, shortening the calf muscles for hours and setting the stage for a cramp.

Warming up properly before exercise also matters. Muscles that go from rest to intense effort without a gradual transition are more vulnerable to the neuromuscular fatigue that triggers cramping. Build up your intensity gradually and don’t push a tired muscle group past its limits without rest.

The Pickle Juice Trick

Pickle juice has a real, measurable effect on muscle cramps, and it works faster than electrolyte replacement can explain. In a study published in Medicine and Science in Sports and Exercise, researchers induced cramps in dehydrated subjects and then had them drink about 2.5 ounces of pickle juice (roughly 1 milliliter per kilogram of body weight). The cramps resolved significantly faster than in subjects who drank water.

The interesting part: the pickle juice couldn’t have restored electrolyte balance that quickly. The researchers concluded that the strong, acidic taste triggers a reflex in the mouth and throat that sends a signal through the nervous system to calm the overactive nerve firing causing the cramp. In other words, it’s the taste, not the salt content, doing most of the work. A small swig at the onset of a cramp is enough. You don’t need to drink a full glass.

Do Magnesium Supplements Help?

Magnesium is one of the most popular recommendations for leg cramps, but the clinical evidence is weaker than most people expect. Two well-designed trials tested magnesium supplements against placebo for nighttime leg cramps. One used 900 mg of magnesium citrate in 58 people and found no significant reduction in cramp frequency. The other used 300 mg of magnesium sulfate in 42 people and found it was no better than placebo for cramp number, severity, duration, or sleep disruption.

That doesn’t mean magnesium is worthless for everyone. If you’re genuinely low in magnesium (common in older adults, people who take certain medications, and those with poor dietary intake), correcting that deficiency could help. But taking high-dose magnesium on top of already-normal levels is unlikely to stop your cramps based on the available data.

Leg Cramps During Pregnancy

Leg cramps are extremely common in the second and third trimesters, and finding effective relief is frustrating because the evidence for supplements during pregnancy is inconclusive. A Cochrane review looked at magnesium, calcium, vitamin B, vitamin D, and vitamin C for pregnancy-related leg cramps. Magnesium showed mixed results: one small trial found women were nearly six times more likely to report no cramps after treatment, while other trials found it made little difference. Calcium, vitamin D, and vitamin C showed no consistent benefit.

What does help is the same set of physical strategies that work for anyone: stretching your calves before bed, staying well hydrated, and massaging a cramp when it strikes. Gentle calf stretches (leaning into a wall with one leg extended behind you) are safe throughout pregnancy and target the muscles most likely to cramp.

When a Cramp Might Be Something Else

Most leg cramps are harmless and resolve on their own. But some symptoms that feel like a cramp can signal something more serious. Deep vein thrombosis, a blood clot in a leg vein, can cause cramping or soreness that typically starts in the calf. The key differences: DVT pain is usually accompanied by swelling in the leg, a change in skin color (red or purple), and a feeling of warmth in the affected area. A muscle cramp, by contrast, produces a hard, visibly contracted muscle that releases within minutes. DVT pain tends to persist and worsen.

It’s also worth paying attention to cramps that happen frequently without an obvious trigger like exercise or dehydration, cramps that don’t respond to stretching, or cramps accompanied by muscle weakness or numbness. These patterns can point to nerve compression, circulation problems, or medication side effects that deserve a closer look.