Stretching the cramping muscle is the single most effective immediate remedy for a leg cramp, and nightly stretching before bed is the best-studied way to prevent them from coming back. Beyond that, the options get murkier. Supplements, hydration, and home remedies like pickle juice all have some evidence behind them, but the science is more complicated than most people expect.
Immediate Relief: Stretching the Right Way
When a cramp hits, your goal is to lengthen the muscle that’s locked up. For the most common type, a calf cramp, keep your leg straight and pull the top of your foot toward your face. You can also stand up, put your weight on the cramped leg, and press down firmly. This works for cramps in the back of your thigh too.
If the cramp is in the front of your thigh, do the opposite: pull your foot up behind you toward your buttock, holding a chair for balance. In both cases, hold the stretch until the spasm releases, which usually takes 15 to 30 seconds. Following up with gentle massage or a warm towel can help ease the lingering soreness that sometimes sticks around after the cramp itself passes.
Why Nightly Stretching Prevents Cramps
If you get cramps regularly, especially at night, a consistent stretching routine is the intervention with the strongest evidence. A randomized trial of older adults found that stretching the calf and hamstring muscles every night before bed reduced the frequency of nocturnal cramps by an average of 1.2 cramps per night over six weeks. The severity of the cramps that did occur also dropped.
The routine doesn’t need to be complicated. A standard calf stretch (leaning into a wall with one leg back, heel on the floor) and a hamstring stretch (sitting with one leg extended, reaching toward your toes) held for about 30 seconds each, repeated two to three times per leg, is enough. The key is doing it consistently, right before you get into bed.
The Electrolyte Question
Most people assume leg cramps come from low potassium, magnesium, or sodium. The reality is less straightforward. According to a review from the American Academy of Family Physicians, neither exercise-related cramps nor nocturnal cramps have been consistently associated with dehydration or disturbances of electrolytes like potassium, sodium, and magnesium. The current thinking is that cramps are more likely caused by muscle fatigue and nerve dysfunction than by any measurable mineral deficiency.
That said, severe electrolyte imbalances from illness, heavy sweating, or certain medications can contribute to cramping. The distinction matters: if you’re generally healthy and eating a normal diet, loading up on potassium supplements or sports drinks is unlikely to fix the problem. No evidence supports the routine use of potassium or calcium supplements for leg cramps.
Magnesium Supplements
Magnesium occupies a gray area. Clinical trials on magnesium for leg cramps have produced mixed results, but many people report improvement, and it remains one of the most commonly recommended supplements for this purpose. For most adults with healthy kidneys, a daily dose of 250 to 500 milligrams is considered safe.
The form you choose matters. Magnesium glycinate is gentle on the stomach and less likely to cause diarrhea, making it a good default choice. Magnesium citrate is absorbed well but has a laxative effect, which could be a bonus or a drawback depending on your digestion. Magnesium oxide is the cheapest and most widely available, but your body absorbs it less efficiently. Chelated forms of magnesium, where the mineral is bonded to amino acids, are generally absorbed better than non-chelated versions.
B Vitamins: A Small but Promising Signal
A 12-week randomized trial of 28 older adults in Taiwan found that daily supplementation with a vitamin B complex induced remission of muscle cramps in 86% of treated patients, compared with no improvement in the control group. The participants were not known to be vitamin B deficient before the trial, which makes the result more interesting. This is a small study, so it’s not definitive, but B complex supplements are inexpensive and carry minimal risk for most people.
Pickle Juice: Surprisingly Effective
Pickle juice sounds like a folk remedy, but there’s a real mechanism behind it. A study published in Medicine and Science in Sports and Exercise found that drinking about 2.5 ounces of pickle juice (roughly 1 milliliter per kilogram of body weight) shortened electrically induced cramps by about 49 seconds compared to water. The effect kicked in too fast to be explained by digestion or rehydration.
Researchers believe the strong, acidic taste triggers a reflex in the mouth and throat that signals the nervous system to shut down the overactive nerve firing causing the cramp. It’s not about replacing salt or electrolytes. It’s about the sharp sensory jolt. This same logic is why some people swear by mustard, which contains similar pungent compounds. If you get cramps during exercise or at night, keeping a small container of pickle juice nearby is a low-risk option worth trying.
What to Avoid: Quinine
Quinine, found in tonic water and sometimes sold as a supplement, was once widely prescribed for leg cramps. The FDA has explicitly stated that quinine is not considered safe or effective for treating or preventing leg cramps. It is approved only for treating malaria.
The risks are serious. Quinine can cause a dangerous drop in platelet count, life-threatening allergic reactions, and heart rhythm abnormalities. Fatalities and kidney failure requiring dialysis have been reported. Some people drink tonic water thinking the small amount of quinine will help. The dose in tonic water is much lower than a prescription, but the FDA’s position is clear: the risk-to-benefit ratio does not justify using quinine for cramps in any form.
Hydration Still Matters
Even though the link between dehydration and cramps is weaker than most people assume, staying well hydrated is still a reasonable baseline strategy, especially if your cramps tend to occur after exercise or on hot days. The American Council on Exercise recommends drinking 17 to 20 ounces of water about two hours before exercise and 7 to 10 ounces every 10 to 20 minutes during exercise. Outside of exercise, drinking enough to keep your urine pale yellow is a practical indicator that your fluid levels are adequate.
Cramps vs. Something More Serious
A typical leg cramp is painful but harmless. It grabs, holds for a few seconds to a few minutes, and then lets go. Some symptoms, however, look like a cramp but signal a deeper problem. Deep vein thrombosis, a blood clot in a deep leg vein, can cause pain, cramping, or soreness that often starts in the calf. It can also cause swelling in one leg, a change in skin color to red or purple, and a feeling of warmth in the affected area. Unlike a cramp, these symptoms don’t resolve with stretching and tend to persist or worsen. DVT can also occur without noticeable symptoms. If your leg pain is accompanied by swelling, discoloration, or warmth, especially in only one leg, that warrants prompt medical evaluation.

