For an active muscle cramp, the fastest relief comes from stretching the affected muscle, not from any pill or supplement. To prevent recurring cramps, magnesium, vitamin B complex, and electrolyte-rich fluids are the most common options, though the evidence behind each varies. What works best depends on whether your cramps are occasional, exercise-related, or happening regularly at night.
What to Do During an Active Cramp
No supplement or medication works fast enough to stop a cramp that’s already happening. Stretching is the only reliable way to end one quickly. For a calf cramp, keep your leg straight and pull the top of your foot toward your face. You can also stand on the cramped leg and press your weight down firmly, which works for calf and back-of-thigh cramps alike. For a front thigh cramp, pull your foot up behind you toward your buttock while holding a chair for balance. Gently massage the muscle while stretching it.
One newer approach involves drinking a small amount of something intensely spicy or acidic, like pickle juice, hot sauce diluted in water, or mustard. These work not because of their salt content but because of a neurological reflex. Pungent ingredients activate specific sensory channels in the mouth and upper digestive tract, which appear to reduce the excitability of the nerve signals driving the cramp. The Australian Institute of Sport classifies these “tastants” as a Group B supplement, meaning there’s emerging but not yet conclusive evidence. Still, many athletes and trainers swear by a shot of pickle juice, and the mechanism is plausible: it’s fast (working within a minute or two), cheap, and carries essentially no risk.
Magnesium: The Most Popular Supplement
Magnesium is the supplement most people reach for, and it plays a genuine role in how muscles relax after contraction. If your body is low on magnesium, your muscles may be more prone to involuntary tightening. The typical dose studied for chronic leg cramps is 300 mg of elemental magnesium taken at night, usually as magnesium citrate dissolved in water. A randomized, placebo-controlled trial published in Medical Science Monitor tested exactly this dose in people with persistent leg cramps and found it was a reasonable therapeutic option. Magnesium citrate and magnesium glycinate are generally better absorbed than magnesium oxide, which is cheaper but more likely to cause loose stools.
For pregnancy-related leg cramps, magnesium salts have shown effectiveness in multiple studies, though the ideal dose for pregnant individuals hasn’t been standardized. If you’re pregnant and dealing with frequent cramps, it’s worth discussing magnesium supplementation with your prenatal care provider, since needs shift during pregnancy.
One important caveat: if your magnesium levels are already normal, supplementing may not help much. Magnesium works best when your cramps are tied to a genuine shortfall, which is common in people who sweat heavily, take certain medications (like diuretics), or don’t eat enough leafy greens, nuts, and whole grains.
Potassium, Sodium, and Electrolyte Balance
Muscle cramps during or after exercise are often tied to fluid and electrolyte losses from sweat. Potassium is essential for nerve signal transmission and muscle contraction, while sodium helps your body retain the water it needs. When these minerals drop too low, your muscles become more irritable and prone to cramping.
You don’t necessarily need a fancy sports drink. For most people, eating a banana or a handful of dried apricots (both high in potassium) and adding a pinch of salt to water after heavy sweating does the job. If you prefer a sports drink, isotonic versions replace water, electrolytes, and sugar in balanced proportions, making them a solid choice during prolonged exercise. Hypotonic drinks contain less sugar and prioritize faster water absorption, which is better when hydration itself is the main goal. Either type is more effective than plain water alone for cramp prevention during extended physical activity.
Vitamin B Complex
An evidence-based review from the American Academy of Neurology rated vitamin B complex as “possibly effective” for muscle cramps, placing it at Level C evidence. That’s not a ringing endorsement, but it’s not nothing either. B vitamins support nerve function, and deficiencies in B1, B6, or B12 can contribute to nerve irritability that makes cramps more likely. People at higher risk of B-vitamin deficiency include older adults, vegetarians, heavy alcohol drinkers, and anyone with absorption issues.
A standard B-complex supplement covers all the bases without requiring you to figure out which specific B vitamin you might be low on. It’s inexpensive, widely available, and carries minimal risk at normal doses.
Medications for Persistent Cramps
If you’re getting cramps frequently, especially nocturnal leg cramps that disrupt your sleep, you may wonder about prescription options. The evidence here is surprisingly thin. The American Academy of Neurology’s review found that quinine derivatives are the only medication with strong evidence of effectiveness for muscle cramps, but the FDA has explicitly warned against using quinine for this purpose. Quinine can cause dangerous drops in platelet counts, severe allergic reactions, and heart rhythm problems. Fatalities and kidney failure requiring dialysis have been reported. Quinine is only FDA-approved for treating malaria, and using it for leg cramps is considered off-label and risky.
Drinking tonic water for cramps, a popular folk remedy, delivers quinine in much lower doses but still carries risk with regular use and provides too little of the compound to reliably help.
Other medications sometimes prescribed for cramps, like certain muscle relaxants and anti-seizure drugs, are used in clinical practice but have never been formally tested for this purpose in clinical trials. Calcium channel blockers have Level C evidence (possibly effective) from the same neurology review. In practice, most doctors will try supplements and lifestyle changes before reaching for any prescription.
When Cramps Signal Something Else
Most muscle cramps are harmless, caused by overuse, dehydration, or minor mineral imbalances. But cramps that happen frequently, affect unusual muscle groups, or don’t respond to basic remedies can sometimes point to an underlying condition. Compressed nerves from a spinal cord issue or pinched nerve in the neck or back can trigger cramps. Poor blood flow to the muscles, thyroid disorders, and nerve conditions are other recognized causes. People on dialysis also experience cramps at higher rates.
If another medical problem is driving your cramps, treating that problem is what actually resolves them. No amount of magnesium will fix a pinched nerve. Cramps that are getting worse over time, happening at rest without an obvious trigger, or accompanied by muscle weakness or numbness warrant a closer look from a healthcare provider.
A Practical Cramp Prevention Plan
For most people dealing with occasional cramps, a layered approach works well. Stay hydrated throughout the day, not just during exercise, and make sure you’re getting enough potassium and magnesium through food first. Good sources include bananas, avocados, sweet potatoes, spinach, nuts, and seeds. If you exercise heavily or sweat a lot, add electrolytes to your water during and after workouts.
If food alone isn’t cutting it, a magnesium citrate supplement (around 300 mg at night) is a reasonable next step, along with a B-complex vitamin if your diet may be falling short. Gentle stretching before bed can reduce the frequency of nocturnal cramps. And if a cramp does strike, stretch the muscle immediately, massage it, and consider keeping pickle juice or mustard packets on hand for a quick neurological reset.