Stretching the cramped muscle is the single most effective thing you can do for a leg cramp in the moment. For longer-term prevention, staying hydrated with electrolyte-containing drinks, stretching before bed, and ensuring adequate magnesium and B vitamin intake all help reduce how often cramps strike. Here’s what works, what’s overhyped, and what to watch out for.
What to Do During a Cramp
When a leg cramp hits, your goal is to lengthen the contracted muscle. For a calf cramp, straighten your leg and pull your toes up toward your shin. If you can reach your toes, gently pull them back. Walking around on your heels also forces the calf to stretch. For a thigh cramp, pull the foot on that leg up toward your buttock while holding a chair for balance.
Beyond stretching, a few other things help in the moment. Press your feet firmly against the floor while standing. Massage the muscle with your hands or a foam roller. Apply heat to relax the muscle or ice to dull the pain. Wiggle and walk around once the worst of the spasm passes. Most cramps resolve within a few minutes with these techniques.
Pickle Juice: Surprisingly Effective
Drinking a small amount of pickle juice can shorten a cramp by about 45 to 50 seconds compared to drinking water, based on research published in Medicine and Science in Sports and Exercise. The relief starts remarkably fast, sometimes within 35 seconds of drinking it. That’s far too quick for the body to absorb any nutrients from the juice, which means the effect isn’t about replenishing salt or fluids. Researchers believe the strong, sour taste triggers a reflex in the mouth and throat that signals the nervous system to calm the overactive nerve firing that causes the cramp. Mustard works through a similar mechanism, which is why athletes sometimes keep small packets on hand.
Why Electrolytes Matter More Than Water Alone
Dehydration is often cited as the primary cause of leg cramps, but the relationship is more nuanced than “drink more water.” Research from the Gatorade Sports Science Institute found that when people exercised in heat until they lost 2% of their body weight through sweat, then rehydrated with plain water, their muscles actually became more susceptible to cramping. Those who rehydrated with an electrolyte solution containing sodium, potassium, and magnesium saw the opposite effect: their cramp susceptibility decreased.
The takeaway is straightforward. If you sweat heavily from exercise, heat, or physical labor, plain water dilutes the electrolytes remaining in your body and can make cramps worse. Choose drinks with sodium and potassium, or eat foods rich in these minerals: bananas, avocados, potatoes, and salted nuts. For nighttime cramps not related to exercise, general hydration throughout the day still matters, but loading up on water right before bed won’t prevent them.
Vitamins and Minerals That Help
A B vitamin complex showed promising results in a clinical trial of elderly patients with nighttime leg cramps. In that study, 86% of patients who took a B vitamin complex (including vitamin B6) experienced remission of their cramps compared to placebo. The patients weren’t known to be deficient in B vitamins beforehand, suggesting the benefit wasn’t simply from correcting a shortfall.
Magnesium is one of the most commonly recommended supplements for cramps, though the evidence is mixed. It tends to help most in people who are actually low in magnesium, which is common among older adults, people who take certain blood pressure medications, and those who drink alcohol regularly. Potassium and calcium also play roles in muscle contraction and relaxation, so a diet consistently low in these minerals can contribute to cramping.
Stretching to Prevent Nighttime Cramps
If your cramps tend to strike at night, a brief stretching routine before bed can make a real difference. Focus on your calves: stand facing a wall with one foot behind you, heel flat on the floor, and lean forward until you feel a stretch in the back calf. Hold for 20 to 30 seconds and repeat on each side. For the front of the thigh, stand on one leg, pull the other foot toward your buttock, and hold. Doing this consistently, not just on nights when you remember, is what produces results over time.
Sleeping with loose blankets helps too. Heavy or tightly tucked sheets can push your feet downward, keeping your calf muscles in a shortened position all night, which makes spontaneous cramping more likely.
Quinine: A Remedy to Avoid
Quinine, found in tonic water and previously sold in prescription form for cramps, is not considered safe or effective for leg cramps by the FDA. It carries risks of serious blood disorders, including conditions that cause dangerously low platelet counts, kidney failure requiring dialysis, and fatal heart rhythm changes. The FDA has issued multiple warnings since 2006 and added a boxed warning (the strongest type) to quinine labeling. Some people still drink tonic water hoping for relief, but the amount of quinine in commercial tonic water is too low to have a meaningful effect on cramps, and pursuing higher doses through any means is genuinely dangerous.
Prescription Medications for Severe Cases
For people with frequent, disruptive cramps that don’t respond to stretching, hydration, and supplements, a handful of prescription options exist, though none have strong enough evidence to be considered a go-to treatment. Medications that have shown some benefit in small studies include certain muscle relaxants, calcium channel blockers, and nerve pain medications. The evidence for all of these is rated low quality, so they’re typically reserved for cases where cramps seriously affect sleep or daily life and simpler approaches have failed.
When Cramps Signal Something Else
Most leg cramps are harmless, but certain patterns point to underlying conditions worth investigating. Cramping or pain in your calves, thighs, or hips that consistently starts when you walk and stops when you rest is a hallmark of peripheral artery disease, where narrowed blood vessels restrict blood flow to the legs. Other signs include coldness in one foot compared to the other, shiny skin on the legs, weak or absent pulses in the feet, and leg numbness or weakness. This type of cramping pain can range from mild to severe, and in advanced cases it occurs even at rest or wakes you from sleep.
Cramps that only affect one leg, come with swelling, redness, or warmth, or persist for hours rather than minutes warrant prompt medical attention, as these can indicate a blood clot rather than a simple muscle spasm.

