How to Fix Leg Cramps: Relief and Prevention

When a leg cramp strikes, stretching the affected muscle is the fastest way to stop it. Most cramps release within seconds to a couple of minutes once you apply a sustained stretch. Beyond that immediate fix, preventing cramps from coming back involves staying hydrated, keeping your electrolytes balanced, and addressing any underlying triggers like medication side effects or sleep position.

How to Stop a Cramp Right Now

The moment a cramp hits, your goal is to lengthen the muscle that’s contracting. For a calf cramp (the most common type), keep your leg straight and pull the top of your foot toward your face. You can also stand up and press your weight down firmly through the cramping leg, which forces the calf to stretch under load. Both techniques work for cramps in the back of the thigh, too.

For a cramp in the front of your thigh, pull your foot up behind you toward your buttock, holding onto a chair or wall for balance. Hold any of these stretches until the spasm fully releases, then gently massage the area to help the muscle relax.

Once the cramp passes, apply a warm, damp towel to the muscle. Heat reduces stiffness and lingering spasm, making it the better choice over ice for this situation. Walking around for a minute or two afterward also helps prevent the cramp from returning immediately.

Stay Hydrated With the Right Amount

Dehydrated muscles cramp more easily, and most people underestimate how much fluid they need, especially on active days. A useful formula from Mass General Brigham: multiply your body weight in pounds by 0.67 to get your daily water target in ounces. Then add 12 ounces for every 30 minutes of exercise. A 150-pound person who exercises for 90 minutes, for example, needs roughly 137 ounces of water that day.

Spreading your intake across the day matters more than drinking large amounts at once. If you’re cramping at night, make sure you’re hydrating well during the afternoon and evening hours, not just in the morning.

Minerals: What Actually Helps

Magnesium, potassium, and calcium are the three minerals most commonly linked to muscle cramps, and you’ll find them recommended everywhere. The reality is more nuanced than supplement companies suggest.

Magnesium gets the most attention, but the clinical evidence is surprisingly weak. A 2013 review of seven randomized trials found magnesium therapy doesn’t appear effective for reducing cramps in the general population. A 2017 trial of 94 adults comparing magnesium oxide capsules to a placebo reached the same conclusion: no measurable benefit. The one exception may be pregnant women, where magnesium shows a small positive effect. If you want to try it anyway, the recommended daily intake is 400 to 420 milligrams for men and 310 to 320 milligrams for women.

Rather than relying on supplements, focus on getting these minerals through food. Bananas, sweet potatoes, and avocados are rich in potassium. Nuts, seeds, and dark leafy greens deliver magnesium. Dairy products and fortified foods cover calcium. A diet that includes a variety of these foods will keep your electrolyte levels in a healthy range without the guesswork of supplementation.

Preventing Cramps While You Sleep

Nocturnal leg cramps are especially frustrating because they pull you out of deep sleep and can leave your muscle sore for hours. Your sleeping position plays a direct role. If you sleep on your back, keep your toes pointing upward rather than letting your feet fall forward, which shortens the calf muscles and invites cramping. If you sleep on your stomach, try hanging your feet over the end of the bed so your calves stay in a neutral or slightly stretched position.

A simple calf stretch before bed can also reduce nighttime cramps. Stand at arm’s length from a wall with your hands flat against it. Step one foot back, keeping that knee straight and your heel on the floor. Bend your front knee forward slowly until you feel a stretch in the back calf. Hold for about 30 seconds, then switch legs. This lengthens the muscle fibers before they spend hours in a contracted resting state.

Medications That Cause Cramps

If your cramps started or worsened around the same time you began a new medication, the drug may be the culprit. Cholesterol-lowering statins are one of the most common offenders. Muscle pain, soreness, and cramping are well-documented side effects, and simvastatin (Zocor) at high doses carries a higher risk than other statins. Diuretics (water pills) used for blood pressure can also trigger cramps by flushing out potassium and magnesium through urine.

If you suspect a medication is behind your cramps, talk to your prescriber about alternatives or dosage adjustments. Don’t stop taking a prescribed medication on your own.

Why You Should Avoid Quinine

Quinine, found in tonic water and once widely prescribed for leg cramps, is not considered safe or effective for this purpose. The FDA has issued multiple warnings since 2006, including a boxed warning on the drug’s label. Quinine can cause a dangerous drop in blood platelets, life-threatening allergic reactions, and heart rhythm problems. Fatalities and kidney failure requiring dialysis have been reported. It remains FDA-approved only for treating malaria.

Leg Cramps During Pregnancy

Leg cramps are common during the second and third trimesters, typically striking at night. The same calf stretch described above (wall stretch, 30 seconds per leg) is one of the safest and most effective tools. Staying physically active during pregnancy, even with moderate walking, helps keep muscles conditioned and less prone to spasm.

Calcium deserves extra attention during pregnancy. Some research suggests that lower blood calcium levels during pregnancy contribute to cramping. The recommended daily intake is 1,000 milligrams. Magnesium supplements may also provide a small benefit for pregnant women specifically, even though they don’t seem to help the general population. If a cramp does hit, stretching the calf, walking briefly, and then elevating your legs can prevent it from recurring. A warm bath or ice massage on the sore spot can ease residual discomfort.

When a Cramp Might Be Something Else

Most leg cramps are harmless, but certain symptoms suggest something more serious. Deep vein thrombosis (a blood clot in a deep leg vein) can mimic cramping, starting as pain or soreness in the calf. The key differences: DVT typically causes visible leg swelling, a change in skin color (red or purple), and a feeling of warmth in the affected leg. A cramp comes and goes in minutes, while DVT pain tends to persist. Blood clots can also occur without noticeable symptoms.

If leg pain comes with swelling and skin changes, or if you develop sudden shortness of breath, chest pain when breathing deeply, dizziness, or a rapid pulse, seek emergency care. These can be signs that a clot has traveled to the lungs.

Cramps that happen frequently (several times a week), don’t improve with stretching and hydration, or cause significant muscle weakness warrant a medical evaluation to rule out nerve compression, circulation problems, or electrolyte imbalances that need targeted treatment.