How to Stop Leg Pain at Night: Causes and Relief

Nighttime leg pain usually comes from muscle cramps, and the fastest way to stop one in progress is to stretch the affected muscle by flexing your foot upward toward your shin and holding for 15 to 30 seconds. But if leg pain keeps waking you up, the real fix depends on what’s causing it. Cramps, restless legs, poor circulation, and nerve irritation all feel different and respond to different strategies.

What’s Causing Your Leg Pain at Night

The most common culprit is nocturnal leg cramps: sudden, involuntary contractions that lock up the calf, thigh, or foot. They strike without warning, last anywhere from a few seconds to several minutes, and leave behind a sore, tender muscle. They’re more frequent in adults over 50, during pregnancy, and after long days on your feet.

Restless legs syndrome (RLS) is often confused with cramps but feels quite different. RLS produces an uncomfortable urge to move your legs, usually while you’re trying to fall asleep. It’s generally not painful in the sharp, seizing way a cramp is, and the sensations tend to last longer. Moving the legs temporarily relieves the discomfort, while moving during a cramp usually makes it worse.

Peripheral artery disease (PAD) causes leg pain when fatty deposits narrow the arteries and restrict blood flow. This pain typically shows up during walking and fades with rest, but in more advanced cases it can wake you from sleep or appear while you’re lying down. It often affects the calves and may feel like aching, heaviness, or cramping.

Nerve-related pain, or peripheral neuropathy, produces burning, tingling, or pins-and-needles sensations, most often in the feet and lower legs. It tends to worsen at night partly because there are fewer distractions and partly because lying flat can increase pressure on irritated nerves. Diabetes is the most common cause, but vitamin B12 deficiency can also damage the peripheral nerves in the legs, leading to similar symptoms.

How to Stop a Cramp When It Hits

When a cramp seizes your calf in the middle of the night, your instinct is to grab the muscle and wait it out. A better approach is to actively stretch against the contraction. Point your toes up toward your knee and gently straighten your leg. If you can stand, lean into a wall with the cramping leg extended behind you, heel flat on the floor, until you feel a deep stretch through the calf. Hold it until the spasm releases.

Once the cramp lets go, walk around for a minute or two to keep blood flowing to the muscle. Applying a warm towel or heating pad to the area can ease the residual soreness. Ice works too if the muscle feels inflamed, though most people find warmth more comfortable at 2 a.m.

Preventing Cramps Before Bed

A short stretching routine before sleep is one of the most reliable ways to reduce nighttime cramps. Spending two to three minutes stretching your calves, hamstrings, and quads signals those muscles to relax rather than fire involuntarily while you sleep. The wall lean described above works well as a preventive stretch too.

Hydration matters more than most people realize. Dehydration concentrates your blood and reduces the fluid available to muscle cells, making them more prone to spasm. If you tend to cut off fluids early to avoid bathroom trips, try drinking steadily throughout the day so you’re well-hydrated by evening without needing to chug water at bedtime.

Electrolyte balance plays a direct role in muscle function. Low potassium, in particular, is linked to leg cramps and can develop from heavy sweating, certain medications (especially diuretics), or a diet low in fruits and vegetables. Bananas, potatoes, avocados, and leafy greens are all potassium-rich foods worth adding to your routine. Calcium and sodium also contribute to normal muscle contraction, so an overall balanced diet helps more than any single supplement.

Magnesium supplements are widely recommended for cramps, but the clinical evidence is lukewarm. A review from the American Academy of Family Physicians found that short courses of magnesium (under 60 days) don’t meaningfully reduce nighttime cramps. There is limited evidence that taking 226 mg of magnesium oxide daily may help after 60 days of consistent use. So if you try magnesium, give it at least two months before deciding it isn’t working.

What to Do About Restless Legs

If your problem is less about sharp cramps and more about an irresistible urge to move your legs, iron levels are worth checking. Experts at Harvard Health recommend iron supplementation when blood ferritin (a marker of iron stores) is at or below 50 mcg/L. This is a higher threshold than what’s typically flagged as “low” on standard blood work, so your ferritin could technically be in the normal range and still be contributing to restless legs. A simple blood test can clarify this, and iron pills are an inexpensive fix if levels are low.

Beyond iron, reducing caffeine and alcohol intake, keeping a consistent sleep schedule, and doing moderate exercise earlier in the day all help manage RLS symptoms. Vigorous exercise close to bedtime can make things worse.

Sleep Position and Environment

Heavy blankets can push your feet into a pointed-toe position, which shortens the calf muscles and sets the stage for cramps. Sleeping with lighter covers or untucking the sheets at the foot of the bed lets your feet rest in a neutral position. Some people find that placing a pillow at the end of the bed to prop the covers up makes a noticeable difference.

If you spend long days standing, sitting at a desk, or wearing shoes with poor arch support, your leg muscles accumulate fatigue that shows up as cramping once you’re in bed. Supportive footwear during the day and elevating your legs for 15 to 20 minutes in the evening can help your muscles recover before sleep.

Why Quinine Is Not the Answer

Quinine, once a popular remedy for nighttime cramps, carries serious risks. The FDA has explicitly stated that quinine is not considered safe or effective for treating or preventing leg cramps. It is only approved for treating malaria. Quinine can cause dangerous drops in platelet count, severe allergic reactions, and heart rhythm problems. Fatalities and kidney failure requiring dialysis have been reported. Since 2006, the FDA has issued multiple warnings, including a boxed warning on the label. If someone has suggested quinine or quinine-containing tonic water as a cramp remedy, the risk far outweighs any potential benefit.

Red Flags That Need Medical Attention

Most nighttime leg pain is uncomfortable but harmless. Certain patterns, however, point to something more serious. Deep vein thrombosis (DVT), a blood clot in a leg vein, can cause cramping or soreness that starts in the calf and is accompanied by swelling, skin that turns red or purple, and warmth in the affected leg. DVT can also occur without obvious symptoms, which is why unexplained one-sided leg swelling always warrants prompt evaluation.

Leg pain that occurs at rest and doesn’t respond to stretching, especially if your feet or toes look pale or feel cold, may signal advanced peripheral artery disease and reduced blood flow. Persistent burning, numbness, or tingling in both feet that worsens over weeks could indicate nerve damage from undiagnosed diabetes or a B12 deficiency. And cramps that happen frequently, resist all the self-care strategies above, or come with muscle weakness deserve a conversation with your doctor to check for underlying electrolyte imbalances or other conditions.