What to Take for Leg Cramps at Night: Vitamins & More

No single supplement or medication is proven to reliably stop nocturnal leg cramps, but several options show enough promise to be worth trying. The most effective approach combines what you take with simple changes to how you stretch, move, and set up your bed before sleep. Here’s what the evidence actually supports.

Why Nighttime Leg Cramps Happen

Nocturnal leg cramps are sudden, involuntary contractions, usually in the calf or foot, that strike during sleep or while lying still. They affect up to 60% of adults at some point and become more common with age. The exact mechanism isn’t fully understood, but the triggers are well mapped: dehydration, low levels of key electrolytes (sodium, potassium, magnesium), prolonged sitting or standing during the day, and certain medications.

Diuretics (water pills), statins, blood pressure medications like angiotensin II receptor blockers, birth control pills, and bronchodilators used for asthma are all linked to increased cramping. Stimulants like caffeine, nicotine, and pseudoephedrine (found in many cold medicines) can also contribute. If your cramps started or worsened after beginning a new medication, that connection is worth exploring with whoever prescribed it.

Magnesium: Popular but Complicated

Magnesium is the most commonly recommended supplement for leg cramps, and it’s the one with the most research behind it. Unfortunately, that research is mixed. A meta-analysis of five trials involving 307 people found no meaningful difference in cramp frequency at four weeks between magnesium and placebo. A separate analysis focused on pregnant women, who are especially prone to leg cramps, also found no benefit.

There is one notable exception. A larger randomized, double-blind trial of 184 people found that magnesium oxide taken daily made no significant difference at 30 days, but by 60 days, the treatment group experienced a real drop: from about 5.4 cramps per week at baseline down to 1.9, compared to a drop from 6.4 to only 3.7 in the placebo group. Cramp duration also shortened significantly in the magnesium group after two months.

The takeaway: magnesium probably won’t work as a quick fix, but it may help if you stick with it for at least two months. The NIH recommends 400 to 420 mg of magnesium daily for men and 310 to 320 mg for women from all sources. The upper limit for supplemental magnesium (from pills, not food) is 350 mg per day. Going above that can cause diarrhea and stomach cramps, which is its own kind of misery at night. Magnesium glycinate and magnesium citrate tend to be better absorbed and easier on the stomach than magnesium oxide.

Potassium, Sodium, and Staying Hydrated

Electrolytes are minerals that help your nerves fire and your muscles contract and relax properly. When sodium, potassium, or magnesium levels drop too low, muscles can misfire and cramp. You don’t need a sports drink to fix this. Bananas, potatoes, beans, leafy greens, and dairy products are all rich in potassium. Salting your food normally and drinking enough water throughout the day covers sodium for most people.

Dehydration is one of the most overlooked causes. If you exercise, sweat heavily, take a diuretic, or simply don’t drink much water in the evening, your electrolyte balance can shift enough to trigger cramps. A glass of water before bed is a simple starting point, though you’ll need to balance that against not wanting to wake up for other reasons.

B Vitamins

There’s limited but interesting evidence for B vitamins. One controlled study of 28 patients found that a B-complex supplement containing 30 mg of vitamin B6 daily induced remission of muscle cramps in 86% of treated patients who were not known to be deficient in any vitamin. That’s a striking number, but it comes from a single small study with incomplete reporting on compliance. It’s not enough to make a strong recommendation, but given that B-complex supplements are inexpensive and generally safe at standard doses, some people find them worth trying.

What Not to Take

Quinine, the bitter compound in tonic water, was once the go-to prescription for leg cramps. The FDA pulled it from that use because of serious and sometimes fatal side effects, including dangerous drops in platelet count, kidney failure requiring dialysis, and heart rhythm problems. Quinine remains approved only for treating malaria. Drinking tonic water for cramps delivers a much smaller dose, but it’s not a reliable treatment, and the risks aren’t zero. Vitamin E and the pain-relief drug verapamil have also been studied and found ineffective for idiopathic nocturnal leg cramps.

What to Do When a Cramp Strikes

When a cramp hits at 2 a.m., you want relief now, not in 60 days. The fastest way to break a calf cramp is to flex your foot by pulling your toes toward your shin. You can do this by hand or by standing up and pressing your weight into the cramping leg. Massaging the muscle while it’s contracted also helps. Most cramps resolve within a few minutes on their own, but actively stretching shortens the episode and reduces the lingering soreness that can last into the next day.

Nightly Habits That Reduce Cramps

Some of the most effective prevention doesn’t come from a bottle at all. Stretching your calves for a few minutes before bed is one of the most consistently recommended strategies. A simple wall stretch works: stand an arm’s length from a wall, place your palms flat against it, and step one foot back while keeping that heel on the ground. Hold for 20 to 30 seconds on each side.

Riding a stationary bike for even a few minutes before bed can also help by gently fatiguing the muscles and promoting blood flow. Tight bedsheets that push your feet into a pointed position can trigger calf cramps, so loosening the covers at the foot of the bed or letting your feet hang free makes a real difference. During the day, wearing supportive shoes rather than flat sandals or going barefoot helps prevent the kind of foot and calf fatigue that shows up as cramps later that night.

Putting It Together

If you’re looking for a practical plan, start with the non-supplement strategies: calf stretches before bed, loose covers, adequate water, and potassium-rich foods. Layer in a magnesium supplement at a moderate dose (200 to 350 mg of supplemental magnesium) and give it a full two months before deciding if it’s helping. A B-complex vitamin is a reasonable addition if magnesium alone isn’t enough. Review any medications you take that might be contributing, and track your cramp frequency so you can actually see whether changes are working rather than relying on memory. Most people who combine these approaches see meaningful improvement within a few weeks to a couple of months.