When Your Legs Hurt at Night: Causes and Relief

Nighttime leg pain has several common causes, and the type of pain you feel points toward what’s going on. Cramping, aching, throbbing, and restless sensations each have different triggers, and most of them get worse at night for specific, identifiable reasons. Here’s what’s likely happening and what you can do about it.

Why Legs Hurt More at Night

During the day, walking and moving your legs helps blood flow back toward your heart. When you lie down, gravity stops assisting that return flow, and blood can pool in your lower legs. For people with weakened veins or narrowed arteries, this shift is enough to trigger pain that wasn’t noticeable while standing or walking. Your muscles also stay in one position for hours during sleep, which can shorten tendons and increase nerve excitability, setting the stage for cramps.

Nocturnal Leg Cramps

These are sudden, involuntary contractions, usually in the calf, that can wake you from a dead sleep. They result from motor nerves firing rapidly and repeatedly at rates much higher than normal muscle contractions. The trigger is typically spontaneous misfiring of nerve endings in the muscle rather than a problem in the brain or spinal cord.

Several factors make cramps more likely. As you age, you naturally lose motor neurons in the legs (more so than in the arms), which can make the remaining nerves more excitable. Tendons shorten with age and during prolonged immobility, like a full night in bed, further increasing that excitability. Dehydration, low potassium, low calcium, and low vitamin D levels can all contribute. If you’ve been on your feet all day or started a new exercise routine, fatigued muscles are more prone to cramping that night.

When a cramp hits, stretching the affected muscle provides the fastest relief. For a calf cramp, pull your toes toward your shin or stand and press your heel into the floor. Walking for a few minutes afterward helps the muscle relax fully.

Restless Legs Syndrome

Restless legs syndrome (RLS) feels different from a cramp. It’s an uncomfortable urge to move your legs, often described as crawling, pulling, or tingling deep inside the leg. The sensation builds when you’re sitting still or lying down and gets worse in the evening and at night. Moving your legs temporarily relieves it, which is why people with RLS often pace, stretch, or shift positions constantly before falling asleep.

RLS is a neurological condition tied to how the brain processes dopamine, and it runs in families. Low iron levels are a well-established trigger, even when blood counts look otherwise normal. If you recognize this pattern of discomfort that only shows up at rest and only improves with movement, it’s worth having your iron levels checked, specifically a test called ferritin.

Poor Circulation and Vein Problems

Varicose veins cause a heavy, throbbing ache that often worsens at night. Damaged valves in the veins allow blood to pool instead of flowing efficiently back to the heart. Lying flat removes the help gravity gives during the day, increasing pressure on those weakened veins. The result is throbbing, heaviness, swelling, and sometimes cramping.

Peripheral artery disease (PAD) causes a different kind of nighttime pain. Narrowed arteries can’t deliver enough blood to meet even your legs’ resting needs. When you lie flat, gravity no longer helps push blood down to your feet, and the reduced flow causes a burning or aching pain in the forefoot or toes. A hallmark of this condition: the pain improves when you dangle your feet over the side of the bed or stand up. If you find yourself sleeping in a recliner or hanging your legs off the mattress for relief, PAD is a likely cause and something to address promptly, since it signals significant artery narrowing.

Nerve-Related Pain

Sciatica and other forms of nerve compression often flare at night because lying down changes how pressure is distributed along your spine. A herniated disc or narrowed spinal canal that barely bothers you while walking can press on nerves once you’re horizontal, sending shooting or burning pain down the back of your leg.

Sleep position makes a real difference here. Sleeping on your back with a pillow under your knees keeps your spine in a neutral position and reduces arching in the lower back. Side sleeping with a pillow between your knees aligns the hips and takes pressure off the pelvis. If spinal stenosis (narrowing of the spinal canal) is the root cause, a slightly curled position can help. Sleeping in the fetal position, using a wedge pillow to elevate your upper body, or reclining in an adjustable bed opens up the narrowed spaces in the spine and often provides noticeable relief.

Does Magnesium Help?

Magnesium is one of the most popular home remedies for leg cramps, but the clinical evidence is underwhelming. A meta-analysis of seven randomized controlled trials found that magnesium supplements did not significantly reduce nighttime leg cramps compared to placebo in the general population. The one exception was pregnant women, who showed a small but measurable benefit. Magnesium also caused slightly more digestive side effects than placebo. If you want to try it, it’s unlikely to cause harm at standard doses, but don’t expect dramatic results.

Quinine, sometimes recommended informally for leg cramps, carries serious risks. The FDA has explicitly warned against using it for nighttime cramps. It is only approved for treating malaria. Reports of patients using it off-label for cramps have documented severe drops in platelet counts, dangerous bleeding, kidney damage, and deaths. The FDA’s position is clear: the risks far outweigh any potential benefit for leg cramps.

What Actually Helps

For cramps, gentle calf stretches before bed are one of the most consistently effective preventive measures. Stand about arm’s length from a wall, step one foot back, and press the heel down while leaning forward. Hold for 30 seconds on each side. Staying well hydrated throughout the day and ensuring adequate potassium (bananas, potatoes, leafy greens) and calcium intake also reduces cramp frequency.

For aching from vein problems, elevating your legs on a pillow while you sleep helps counteract blood pooling. Compression socks worn during the day can reduce the swelling and pressure that build up by evening. For nerve pain, the pillow strategies described above are your best first-line approach at home.

Light movement before bed, like a short walk or gentle stretching routine, improves circulation and can reduce symptoms across nearly all of these causes. Avoid sitting or standing in one position for long periods in the hours before sleep.

Signs That Need Prompt Attention

Most nighttime leg pain is uncomfortable but not dangerous. However, a few patterns signal something more urgent. Deep vein thrombosis (a blood clot in a leg vein) can cause pain, swelling, warmth, and skin color changes, usually in one leg only. The calf may feel sore or tender, similar to a pulled muscle. The skin may appear red or purple. DVT can also occur without obvious symptoms, but if you notice sudden one-sided swelling with warmth or discoloration, especially after a long flight, surgery, or period of immobility, seek medical evaluation quickly. A clot that breaks loose can travel to the lungs and become life-threatening.

PAD symptoms like rest pain in the feet or toes also warrant prompt evaluation, as they indicate significantly reduced blood flow that can lead to tissue damage if untreated.