Leg Cramps at Night: What to Do and What to Avoid

When a leg cramp jolts you awake, the fastest relief comes from stretching the cramping muscle. For a calf cramp, flex your foot upward by pulling your toes toward your shin, hold for 10 to 15 seconds, and repeat until the spasm releases. You can also stand and press the ball of your foot into the floor to lengthen the muscle. Most cramps resolve within a few minutes, but the soreness can linger into the next day.

How to Stop a Cramp in Progress

The key is to oppose whatever the muscle is doing. A cramping calf is contracting, so you need to stretch it. If you can stand, step the affected leg back and press your heel into the ground with your knee straight. If the cramp is too intense to stand on, stay in bed and loop a towel or sheet around the ball of your foot, then gently pull your toes toward you.

Deep tissue massage on the cramping muscle can also help it release. Use your thumbs or knuckles to press firmly into the belly of the muscle and work along its length. Some people find that applying a warm towel or heating pad afterward eases the residual ache, while others prefer ice. Neither has strong clinical evidence behind it, but both are safe to try based on what feels better to you.

Why Cramps Happen at Night

Nocturnal leg cramps are involuntary contractions, most often in the calf but sometimes in the foot or thigh. They tend to strike during sleep partly because of the position your feet naturally fall into when you’re lying down. When your toes point downward (a position called plantarflexion), the calf muscle shortens, and shortened muscles are more prone to sudden spasms. Nerve signals that normally keep muscle contractions in check may also become less precise during sleep, allowing a motor nerve to fire excessively and lock the muscle into a sustained contraction.

Several factors raise your risk. Dehydration, especially from exercise, hot weather, or not drinking enough fluids during the day, can throw off the balance of electrolytes your muscles depend on. Sodium, potassium, calcium, and magnesium all play roles in muscle contraction and relaxation. When any of these dips too low, muscles become more excitable and more likely to cramp.

Medications and Conditions That Contribute

Certain medications are well-known cramp triggers. Diuretics (water pills) top the list because they increase fluid and mineral loss through urine. Cholesterol-lowering statins, some blood pressure medications, bronchodilators, oral contraceptives, and stimulants like caffeine and nicotine are also linked to increased cramping. If your nighttime cramps started or worsened around the time you began a new medication, that connection is worth exploring with whoever prescribed it.

A range of medical conditions can also make cramps more frequent. These include type 1 and type 2 diabetes, chronic kidney disease, thyroid disorders (both overactive and underactive), cirrhosis, Addison’s disease, and alcohol use disorder. In most of these conditions, the cramps are a downstream effect of changes in metabolism, nerve function, or electrolyte balance. Cramps that are frequent, severe, or don’t respond to the strategies below may be a signal to look into one of these underlying causes.

Evening Stretching to Prevent Cramps

A short stretching routine before bed is one of the most consistently recommended preventive measures, and anecdotal evidence suggests that a few minutes of light exercise, like walking or pedaling on a stationary bike, can also reduce cramp frequency. For a targeted calf stretch, stand about three feet from a wall, lean forward with your arms outstretched and palms flat against the wall, and keep your feet flat on the floor. Hold for a count of five, release, and repeat for at least five minutes. Doing this three times a day, with the last session shortly before bed, gives the calf muscles time to lengthen and relax before you lie down.

If wall stretches feel awkward, a simple standing lunge works too. Step one foot forward, bend the front knee, and keep the back leg straight with the heel pressed into the ground. You should feel the stretch along the back of your lower leg. Hold for 20 to 30 seconds and switch sides.

Adjustments to Your Sleep Setup

Two easy environmental changes can make a difference. First, untuck the sheets and blankets at the foot of your bed. Tightly tucked covers push your feet into that toes-down position that shortens the calf muscles and invites cramps. Loose bedding lets your feet rest in a more neutral angle. Second, wear supportive shoes during the day. Shoes with poor arch support or flat soles can fatigue the muscles in your lower legs, making them more cramp-prone at night.

Do Magnesium Supplements Help?

Magnesium is the supplement most people reach for, but the evidence is more nuanced than the marketing suggests. A 2023 review from the American Academy of Family Physicians found that short courses of magnesium, under 60 days, do not reduce nocturnal leg cramps. However, one well-designed trial of 184 people found that taking 226 mg of magnesium oxide daily for 60 days did produce meaningful results: cramp frequency dropped from about 5.4 episodes per week to 1.9, compared to a smaller decrease (6.4 to 3.7) in the placebo group. Cramp duration also fell significantly.

The takeaway is that magnesium may help, but only if you stick with it for at least two months. If you try it, magnesium glycinate or magnesium citrate tend to be easier on the stomach than magnesium oxide, though the trial above specifically used the oxide form.

What About B Vitamins?

There is limited but interesting evidence for B-complex vitamins. A small study of 28 people, published in the journal Neurology’s evidence review, found that a B-complex supplement containing 30 mg of vitamin B6 per day led to remission of cramps in 86% of treated patients, even in people who weren’t known to be vitamin deficient. No serious side effects were reported. The study was small and didn’t report detailed compliance data, so the finding is classified as “possibly effective” rather than proven. Still, given the low risk, a B-complex supplement is a reasonable thing to try alongside stretching and hydration.

Stay Hydrated Throughout the Day

Dehydration is one of the most common and fixable contributors to nighttime cramps. Rather than chugging water right before bed (which just means bathroom trips), aim to drink steadily throughout the day. If your urine is pale yellow by evening, you’re generally well-hydrated. On hot days, after exercise, or if you drink alcohol or caffeine, you’ll need more fluids than usual. Adding a source of electrolytes, whether that’s a balanced sports drink, coconut water, or simply eating potassium-rich foods like bananas, potatoes, and leafy greens, can help maintain the mineral balance your muscles need.

Why You Should Avoid Quinine

Quinine, once widely prescribed for leg cramps, is no longer considered safe for this use. The FDA has issued repeated warnings since 2006, including a boxed warning on the drug’s label. Quinine is associated with a dangerous drop in blood platelet counts, severe allergic reactions, and heart rhythm disturbances. Fatalities and kidney failure requiring dialysis have been reported. Quinine is only FDA-approved for treating malaria. If someone suggests tonic water as a cramp remedy (tonic water contains small amounts of quinine), the dose is too low to have a therapeutic effect and the risk-benefit ratio doesn’t justify it even at higher doses.