Nighttime leg pain is remarkably common, affecting an estimated 50 to 60 percent of adults at some point. The causes range from simple muscle cramps to circulatory problems, and the type of pain you feel, where exactly it hits, and what makes it better or worse can tell you a lot about what’s going on.
Nocturnal Leg Cramps
The most common cause of nighttime leg pain is a sudden, involuntary muscle contraction, usually in the calf or the small muscles of the foot. These cramps strike without warning, often jolting you awake with a sharp, intense tightening that can last anywhere from a few seconds to several minutes. The muscle may feel sore for hours afterward. Unlike other causes of leg pain, cramps produce a hard knot you can actually feel under the skin.
The triggers are often mundane: dehydration, sitting or standing in one position for too long during the day, overexertion, or sleeping with your feet pointed downward (which keeps the calf in a shortened position). Electrolyte imbalances, particularly low levels of potassium, calcium, or magnesium, can also play a role. Pregnancy increases the frequency of leg cramps significantly, especially in the second and third trimesters.
Restless Legs Syndrome
Restless legs syndrome (RLS) feels completely different from a cramp. There’s no sudden contraction. Instead, you get an uncomfortable sensation deep inside your legs, often described as crawling, tingling, pulling, or an itch you can’t scratch. The hallmark feature is an overwhelming urge to move your legs, and moving them actually provides temporary relief. The moment you stop, the sensation returns.
RLS symptoms tend to appear or worsen in the evening and at night, particularly when you’re lying still. The underlying biology involves iron deficiency in specific brain regions responsible for producing dopamine, a chemical messenger that helps regulate movement. When iron levels drop in these areas, dopamine signaling becomes erratic. The brain produces more dopamine but becomes less sensitive to it, creating a feedback loop that generates those restless sensations. This is why blood tests for iron and ferritin levels are often the first step in evaluating RLS, and why iron supplementation helps many people with the condition.
How to Tell Cramps From Restless Legs
These two conditions are frequently confused, but they behave in opposite ways. A cramp locks the muscle into a painful contraction. You can see and feel the muscle seize up. With RLS, there’s no visible muscle tightening. The discomfort is more of an internal unease than a sharp pain.
Movement matters too. Walking or stretching will break a cramp, but the relief comes from physically lengthening the contracted muscle. With RLS, any movement helps, even just shifting your legs in bed, because the act of moving itself quiets the abnormal nerve signaling. If your legs hurt and staying still makes it worse while moving makes it better, RLS is the more likely explanation.
Peripheral Artery Disease
When narrowed arteries reduce blood flow to the legs, pain can develop during rest, especially at night. Peripheral artery disease (PAD) typically causes a burning or aching sensation in the legs, feet, or toes when you’re lying flat. Gravity normally helps push blood down to your lower extremities. When you lie down, you lose that assist, and already-compromised arteries struggle to deliver enough oxygen to the tissues.
A telling clue: dangling your legs over the edge of the bed often provides noticeable relief, because gravity restores some of that blood flow. Rest pain from PAD usually signals more advanced disease. Earlier stages cause pain only during walking (called claudication), so if you’re experiencing leg pain while lying down with no exertion involved, that’s a sign the circulation problem has progressed. Other signs include skin that looks pale or feels cool to the touch, slow-healing wounds on the feet, and reduced hair growth on the lower legs.
Medications That Cause Leg Pain
Several common medications can trigger or worsen nighttime leg pain. Statins, prescribed to lower cholesterol, are among the most well-known culprits. The type of statin matters. Lipophilic statins like atorvastatin, simvastatin, and fluvastatin pass easily into muscle tissue and are more likely to cause aches. Hydrophilic versions like rosuvastatin and pravastatin need active transport into cells and tend to cause fewer muscle problems.
If you’re on a statin and experiencing leg pain, certain foods and medications can make it worse by slowing how quickly your body clears the drug. Grapefruit juice, heavy alcohol use, and several classes of prescription medications (including certain blood pressure drugs, antibiotics, and antifungal medications) can all raise statin levels in your body and increase muscle-related side effects. Diuretics, commonly prescribed for high blood pressure, can also contribute to nighttime cramps by depleting potassium and other electrolytes through increased urination.
Nerve-Related Causes
Peripheral neuropathy, damage to the nerves in your legs and feet, often produces burning, tingling, or shooting pain that worsens at night. During the day, your brain is busy processing other sensory input, which can mask milder nerve pain. At night, with fewer distractions, those signals become more noticeable. Diabetes is the most common cause of peripheral neuropathy, but it can also result from vitamin B12 deficiency, alcohol use, or certain autoimmune conditions.
Sciatica, caused by compression of the sciatic nerve in the lower back, can also flare at night. Lying in certain positions may increase pressure on the nerve, sending pain radiating from the lower back down through the buttock and into one leg. Sleeping with a pillow between or under the knees can reduce this pressure for many people.
Stretches and Home Strategies
For cramps, a consistent stretching routine is one of the most effective preventive measures. Stand about three feet from a wall, lean forward with your arms outstretched, and press your palms flat against it while keeping your feet planted on the floor. Hold for a count of five, release, and repeat for at least five minutes. Doing this three times a day, particularly before bed, helps keep the calf muscles lengthened and less prone to sudden contractions.
Staying well hydrated throughout the day makes a difference, especially if you exercise or spend time in heat. Sleeping with loose blankets that don’t push your feet into a pointed position can also help, since tight sheets force the calf into a shortened state that invites cramping. When a cramp does strike, pulling your toes up toward your shin while straightening the leg usually breaks the contraction faster than waiting it out.
Does Magnesium Actually Help?
Magnesium is one of the most popular supplements for leg cramps, but the evidence is mixed. A large systematic review of 11 clinical trials found no meaningful reduction in leg cramps from magnesium supplementation overall. For short courses under 60 days, the data consistently shows little to no benefit over a placebo.
There is one exception worth noting. A well-designed trial of 184 people found that taking magnesium oxide daily for 60 days or longer did significantly reduce cramp frequency, from about 5.4 cramps per week down to 1.9, compared to a smaller improvement with placebo. Cramp duration also dropped substantially. So magnesium may help, but only if you stick with it for at least two months. Short-term use is unlikely to do much.
Warning Signs That Need Prompt Attention
Most nighttime leg pain is benign, but certain patterns warrant quick evaluation. Pain, swelling, redness, and warmth concentrated in one lower leg could indicate a blood clot, particularly if it follows a long period of immobility like a car trip or flight. A leg that appears pale or feels unusually cool compared to the other side suggests a circulation problem that needs assessment. Swelling in both legs combined with difficulty breathing can signal a heart or kidney issue. Any serious leg symptoms that develop suddenly without an obvious cause, such as an injury or new exercise routine, are worth getting checked.

