What to Do for Muscle Cramps: Relief and Prevention

When a muscle cramp hits, the fastest relief comes from gently stretching the cramping muscle and holding it in a lengthened position until the spasm releases, usually within one to three minutes. For a calf cramp, the most common type, this means pulling your toes up toward your shin or stepping forward into a wall stretch. What you do next depends on whether your cramps are occasional or a recurring problem.

How to Stop a Cramp in the Moment

A cramp is an involuntary, sustained contraction of a muscle. The goal is to counteract that contraction by lengthening the muscle. For a calf cramp, flex your foot so your toes point toward your knee. You can also stand and press your heel flat into the floor while leaning forward. For a hamstring cramp (back of the thigh), straighten your leg and lean forward at the hips. For a quadriceps cramp (front of the thigh), pull your foot behind you toward your glute.

Hold the stretch gently. Forcing it can cause a muscle tear. Once the acute spasm passes, massaging the area or applying a warm towel can help relax the remaining tightness. Ice can be useful afterward if the muscle feels sore, which sometimes lingers for hours or even a day or two after a severe cramp.

One unconventional approach that has gained research support: drinking a small amount of pickle juice. The sour taste of the acetic acid in vinegar stimulates receptors in the mouth and throat, triggering a reflex that reduces the nerve signaling driving the cramp. This works within about 30 to 60 seconds in some people, faster than any fluid could be absorbed into the bloodstream. It’s the taste, not the hydration, that does the work.

Why Cramps Happen

For decades, the standard explanation was dehydration and electrolyte loss from sweating. That theory isn’t wrong in every case, but the strongest scientific evidence now points to a different mechanism: altered neuromuscular control. When a muscle is fatigued or held in a shortened position, the nerve signals that tell it to contract become overactive while the signals that tell it to relax become underactive. This imbalance causes the muscle to lock up involuntarily.

This explains why cramps tend to strike at the end of long workouts, during unfamiliar physical activity, or in the middle of the night when your foot is pointed and your calf is in a shortened position. It also explains why stretching works so well as an immediate fix: lengthening the muscle reactivates the inhibitory nerve signals and breaks the cycle.

Dehydration and low electrolytes (sodium, potassium, magnesium, calcium) can still play a role, particularly during prolonged exercise in heat. But well-hydrated athletes get cramps too, and many people who cramp at night aren’t dehydrated at all. The cause is often multifactorial.

Preventing Cramps Before They Start

If you get cramps regularly, daily calf stretches are one of the simplest and best-supported preventive measures. Stand facing a wall with one foot forward and one back, keeping your rear heel on the ground, and lean in for 20 to 30 seconds per side. Doing this two to three times a day, and once right before bed, can significantly reduce the frequency of nighttime cramps.

Other strategies that help:

  • Light evening activity. A brief walk or a few minutes on a stationary bike before bed keeps muscles from tightening up overnight.
  • Footwear and sleep position. Avoid sleeping with your feet pointed (plantar flexion), which shortens the calf. Some people find that sleeping with a pillow at the foot of the bed to keep the feet upright, or wearing shoes with proper support during the day, reduces nighttime cramps. Walking around on your heels for a minute or two before bed is another Cleveland Clinic recommendation.
  • Stay hydrated. While dehydration isn’t the only cause, it’s an easy one to rule out. Drink enough water throughout the day, and if you exercise heavily or sweat a lot, include fluids with electrolytes.

Does Magnesium Actually Help?

Magnesium supplements are one of the most commonly recommended remedies for leg cramps, but the evidence is mixed. In pregnant women, magnesium has shown a clear benefit for reducing leg cramp frequency. For everyone else, the picture is murkier.

One crossover trial published in Medical Science Monitor gave participants magnesium citrate or a placebo. The group that started on placebo and switched to magnesium saw their median cramp count drop from 9 to 5 over the treatment period. But the group that started on magnesium didn’t show the same pattern, and the overall difference between magnesium and placebo didn’t reach statistical significance. Interestingly, 78% of participants felt the treatment helped when they were taking magnesium, compared to 54% on placebo. The researchers concluded magnesium “may be effective” but called for further evaluation. The most common side effect was diarrhea.

If you want to try magnesium, it’s generally safe at recommended supplement doses. Foods rich in magnesium, including nuts, seeds, dark leafy greens, and whole grains, are a reasonable first step before reaching for a supplement.

Why Quinine Is Not Worth the Risk

Quinine, found in tonic water and once commonly prescribed for leg cramps, is no longer approved by the FDA for that purpose. The agency issued a specific warning: quinine use for nighttime leg cramps can cause serious and life-threatening blood reactions, including a dangerous drop in platelet count and a condition that damages red blood cells and kidneys. These reactions are unpredictable, and re-exposure after a previous reaction can trigger an episode that’s faster and more severe than the first. The FDA concluded that the risks outweigh any potential benefit for cramps. The small amount of quinine in commercial tonic water is far lower than a medicinal dose, but it’s not a treatment strategy worth pursuing.

When Cramps Signal Something Else

Most muscle cramps are harmless, if painful. But certain patterns deserve attention. Cramps that happen frequently without an obvious trigger (like exercise or sleep position), cramps that don’t improve with stretching, or cramps accompanied by muscle weakness or wasting could point to an underlying nerve or metabolic issue.

One condition worth knowing about: deep vein thrombosis, a blood clot in a leg vein, can feel like a cramp. The key differences are that DVT pain is often persistent rather than coming in sudden spasms, and it’s typically accompanied by swelling, warmth, or a change in skin color (redness or a purplish hue) in the affected leg. DVT can also occur without noticeable symptoms. If your “cramp” doesn’t behave like a cramp, or if one leg is visibly swollen compared to the other, that warrants prompt medical evaluation.

Peripheral artery disease, thyroid disorders, kidney problems, and certain medications (particularly diuretics and cholesterol-lowering drugs) can all increase cramp frequency. If your cramps are new, worsening, or happening most nights despite preventive efforts, it’s worth investigating with a healthcare provider to rule out these contributing factors.