Why Do My Legs Hurt After Sleeping? Common Causes

Waking up with aching, cramping, or stiff legs usually traces back to one of a handful of causes, ranging from harmless nocturnal muscle cramps to circulation problems that deserve medical attention. The most common culprit in adults over 50 is the nocturnal leg cramp, which affects roughly a third of that age group, but younger people are far from immune. Your sleeping position, mattress, hydration, medications, and underlying health conditions all play a role, and the fix depends entirely on which cause is actually driving the pain.

Nocturnal Leg Cramps

If you’ve ever been jolted awake by a sudden, seizing pain in your calf or the arch of your foot, you’ve experienced a nocturnal leg cramp. These involuntary contractions hit the calf muscles, hamstrings, or foot muscles, and the pain can linger as soreness well into the next morning. Up to 33% of the general population over 50 is affected, and in about 20% of those cases, cramps also strike during daytime rest periods.1PubMed Central. Criteria in diagnosing nocturnal leg cramps: a systematic review They tend to come in clusters: you might go weeks without one, then get several in a single night.

The underlying trigger varies. Dehydration, low magnesium, low potassium, and low sodium all contribute to muscle dysfunction that can set off cramps.2Molecular & Cellular Biomechanics. The biomechanical and physiological strategies of for preventing leg cramps in adolescent swimmers Chronic kidney disease, liver failure, varicose veins, and vascular disease are also associated with frequent nocturnal cramps.1PubMed Central. Criteria in diagnosing nocturnal leg cramps: a systematic review But plenty of people with none of these conditions still get cramps occasionally, especially after an unusually active day or a night spent sleeping in an awkward position that shortens the calf muscle for hours.

The soreness you feel the next morning is real muscle damage on a small scale. A cramp that lasts more than a few seconds can leave the muscle fibers bruised and tender, much like the aftermath of an intense workout. If you’re waking up with that deep, post-cramp ache more than once or twice a week, it’s worth looking at the other causes on this list rather than just writing it off as a random cramp.

Restless Legs Syndrome

Restless legs syndrome (RLS) is a neurological condition that creates an uncomfortable urge to move your legs, usually worst in the evening and overnight. The sensations vary from person to person: some describe crawling, tingling, or pulling feelings deep in the legs, while others feel an ache or burning that only eases when they get up and walk. About 5% of the general population experiences some form of it, though severe cases are less common.3Journal of Neurology Disorders and Stroke. The History of Restless Legs Syndrome: Some Early Clinical Observations

The pain you feel in the morning from RLS is usually indirect. The condition disrupts sleep so thoroughly that you may not get enough deep, restorative rest, and the repeated leg movement throughout the night can leave muscles fatigued and sore by dawn. Research strongly supports that RLS involves a dopamine signaling abnormality in the brain, and iron deficiency appears to play a central role in driving that abnormality.4PubMed. Dopamine and iron in the pathophysiology of restless legs syndrome (RLS) A pilot study on the biochemical and genetic dimensions of RLS reinforced this iron-dopamine connection, finding that brain iron deficiency disrupts the dopamine pathway tied to the condition.5Future Health. Biochemical and genetic analysis of Restless Legs syndrome (RLS): A pilot study

If your legs feel restless rather than crampy, and the discomfort is worst when you’re lying still and improves when you move, RLS is a strong candidate. A simple blood test for ferritin (your body’s iron stores) is often the first diagnostic step, because correcting low iron resolves or improves symptoms for many people.

Circulation Problems

Vascular causes of morning leg pain are less common than cramps or RLS but more medically serious. Peripheral artery disease (PAD) narrows the arteries supplying blood to the legs, and one of its central hallmarks is lower-extremity pain that can present as intermittent cramping during activity, atypical leg pain at rest, and, in more advanced cases, ischemic rest pain that worsens when you’re lying flat at night.6PubMed Central. Understanding the Pain Experience and Treatment Considerations Along the Spectrum of Peripheral Artery Disease The pain tends to feel different from a muscle cramp: it’s often deeper, more burning, and located in the feet or lower legs. Elevating the legs or dangling them over the side of the bed may provide some temporary relief because gravity helps blood flow to the feet.

People with risk factors for atherosclerosis (smoking, diabetes, high blood pressure, high cholesterol) should pay particular attention to leg pain that shows up or worsens at night. A structured evaluation of leg pain typically starts with assessing atherosclerotic risk factors and may include checking the ankle-brachial index, a painless test that compares blood pressure in your ankle to blood pressure in your arm.7DeckerMed Vascular and Endovascular Surgery. Evaluation of Leg Pain

When Morning Leg Pain Could Be a Blood Clot

Deep vein thrombosis (DVT) is the cause you don’t want to miss. A blood clot in the deep veins of the leg can form during extended periods of immobility, including long nights of sleep after surgery or a flight. The classic symptoms are swelling (present in about 71% of confirmed cases) and a cramping or pulling discomfort in the thigh or calf (reported by about 53% of patients).8PubMed. Diagnosis and Treatment of Lower Extremity Venous Thromboembolism: A Review The pain is typically one-sided, and the affected leg may look visibly larger or feel warm to the touch.

DVT is a medical emergency because the clot can break loose and travel to the lungs. If you wake up with new, unexplained swelling and pain concentrated in one leg, especially if you’ve recently been immobile for an extended period or have a history of clotting disorders, get evaluated the same day. This is not a “wait and see” situation.

Medications That Cause Night Cramps

Statins, the widely prescribed cholesterol-lowering drugs, are a common and underrecognized cause of nighttime leg pain. In one study of 3,200 patients, 129 reported nocturnal cramps after taking statins in the evening, and the problem was severe enough that 68 of those patients chose to stop their treatment entirely.9PubMed Central. Why Do My Legs Hurt After Sleeping? Common Causes – Section: Frequency and Impact of Night Cramps Due to Statins The cramps may result from impaired blood supply to the calf and foot muscles, particularly in older adults who already have some degree of arterial narrowing.10PubMed. Simvastatin-lnduced nocturnal leg pain disappears with pravastatin substitution

If you started waking up with leg pain shortly after beginning a statin or changing your dose, mention it to your prescriber. Switching to a different statin has resolved the problem in documented cases, and adjusting the time of day you take the medication sometimes helps too. Diuretics (water pills), certain blood-pressure drugs, and some asthma medications have also been linked to leg cramps, though the evidence for those is less robust than for statins. The key diagnostic clue is timing: if the cramps appeared when a medication started, the medication is suspect.

Alcohol and Nighttime Cramps

Drinking alcohol, even in moderate amounts, substantially raises the odds of waking up with leg cramps. A case-control study of patients over 60 found that alcohol consumption was associated with a dramatically higher likelihood of nocturnal leg cramps, with an odds ratio of about 6.5.11PubMed Central. Association Between Alcohol Consumption and Nocturnal Leg Cramps in Patients Over 60 Years Old: A Case-Control Study The mechanism likely involves a combination of dehydration, electrolyte disruption, and the direct effects of alcohol on nerve and muscle function. If you notice that your morning leg pain correlates with evenings when you’ve had a few drinks, cutting back is a straightforward experiment worth trying.

Your Mattress and Sleep Position

Sometimes the cause is as mundane as the surface you’re sleeping on. A mattress that’s too firm or too soft can force your spine and hips into poor alignment, which shifts strain onto the muscles and joints in your legs. In a study tracking patients who switched to a properly matched mattress, back pain dropped by about 48% and sleep quality improved by roughly 55% after four weeks.12PubMed Central. What type of mattress should be chosen to avoid back pain and improve sleep quality? Review of the literature While that study focused on back pain, the same alignment principles apply to the lower body: a mattress that doesn’t support your hips and knees properly can leave your leg muscles contracted or stretched in ways that generate soreness by morning.

Sleeping position matters too. Stomach sleepers often end up with their feet in a pointed (plantar-flexed) position for hours, which shortens the calf muscles and primes them for cramps. Side sleepers can compress the outer hip and thigh on the bottom side, leading to numbness or aching in the legs. A pillow between your knees if you sleep on your side, or under your knees if you sleep on your back, can reduce the mechanical stress that accumulates overnight.

Fibromyalgia and Chronic Fatigue Syndrome

People living with fibromyalgia or chronic fatigue syndrome (CFS) often report that their legs hurt worst in the morning, and the science suggests a specific sleep architecture problem may be responsible. In patients with CFS, researchers found that disrupted sleep structure, particularly shorter stretches of uninterrupted sleep, was linked to worse morning fatigue and pain. The disruption was not explained by diagnosable sleep disorders or by coexisting fibromyalgia alone, but rather by the fragmentation of sleep itself.13BioMed Central. Sleep structure and sleepiness in chronic fatigue syndrome with or without coexisting fibromyalgia

If you have widespread pain that’s particularly bad in the morning, along with overwhelming fatigue and the persistent feeling that your sleep was not refreshing, these conditions belong on the list of possibilities to discuss with your doctor. The leg pain in fibromyalgia tends to be diffuse and aching rather than localized to one muscle, which helps distinguish it from a simple cramp.

Pregnancy-Related Leg Cramps

Leg cramps are extremely common during pregnancy, especially in the second and third trimesters. The combination of increased body weight, shifting biomechanics, fluid retention, and pressure on blood vessels creates a perfect storm for nighttime calf cramps. A Cochrane review of interventions for pregnancy-related leg cramps found that magnesium supplementation showed some evidence of benefit, while calcium and sodium chloride supplements did not.14PubMed Central. Interventions for leg cramps in pregnancy Multivitamin-mineral supplements also showed a suggestion of benefit, though the evidence was not conclusive.

For pregnant people dealing with nightly cramps, gentle calf stretching before bed (described in the next section) is a safe first-line approach. Magnesium is worth discussing with your prenatal provider, but don’t assume that calcium supplements will fix the problem, since the trial evidence for calcium is weak.

Growing Pains in Children

Children who complain that their legs hurt after sleeping or who wake up crying from leg pain at night may be experiencing growing pains, one of the most common and least understood pediatric pain syndromes. Despite the name, the cause isn’t actually growth itself. Multiple theories have been proposed: altered gait mechanics from joint hypermobility, muscular fatigue after active days, reduced bone density creating an overuse-type syndrome, and psychological stress producing physical symptoms.15PubMed Central. Growing Pains: When to Be Concerned The fatigue theory gets the most anecdotal support from parents, who frequently observe that symptoms are worse on days when their child was especially active.

Sensory testing of children with growing pains has found mild differences in how they process stimuli like cold, vibration, and deep pressure, not just in the legs but more broadly throughout the body. Researchers concluded that growing pains may represent a regional pain syndrome with mild, widespread differences in how the nervous system processes sensory input, rather than a straightforward musculoskeletal problem.16PubMed Central. Somatosensory test responses in children with growing pains That’s a fancy way of saying the pain is real, but the source is probably the nervous system’s sensitivity dial being turned up rather than anything structurally wrong with the bones or muscles.

Growing pains are a diagnosis of exclusion. If the pain is always in the same spot, if it’s accompanied by swelling, limping, or fever, or if it occurs during the day rather than primarily at night, other conditions need to be ruled out.

Stretching Before Bed Actually Works

If nocturnal cramps are the problem, the single most evidence-supported intervention is simple: stretch your calves and hamstrings before you get into bed. A randomized trial in older adults found that nightly stretching before sleep reduced the frequency of nocturnal leg cramps by an average of 1.2 cramps per night compared to controls, and pain severity dropped meaningfully on a standard pain scale.17PubMed. Stretching before sleep reduces the frequency and severity of nocturnal leg cramps in older adults: a randomised trial That effect held over six weeks of follow-up.

The same approach has been tested in pregnant women with similar results. Calf muscle stretching exercises reduced the frequency, duration, and intensity of leg cramps in antenatal mothers compared to a control group.18International Journal of Nursing Care. Effectiveness of Calf Muscle Stretching Exercise on leg Cramps among Antenatal Mothers Attending a Tertiary Care Centre Thiruvananthapuram A separate study combining hamstring stretches, calf stretches, and heel raises before bed also found significant improvements in both pain and sleep quality among older adults.19VIMS JOURNAL OF PHYSICAL THERAPY. Effect of Self stretching before sleep on nocturnal leg cramp, pain & sleep quality among older adults – A Quasi Experimental Study

The routine doesn’t need to be elaborate. A standing wall calf stretch held for 30 seconds on each side, repeated two or three times, and a basic hamstring stretch where you straighten your leg and lean forward at the hips, is enough. The key is consistency: doing it every night before bed rather than only when cramps have already started.

Other Practical Steps Worth Trying

Beyond stretching, a few other interventions address the most common triggers:

  • Hydration: Drink water throughout the day, not just at bedtime. Dehydration concentrates the electrolytes in your blood, which can make muscles more prone to involuntary contractions.
  • Electrolytes: If you sweat heavily, exercise regularly, or eat a restricted diet, pay attention to magnesium and potassium intake. Bananas, leafy greens, nuts, and seeds are good dietary sources. Supplements can help but aren’t a substitute for identifying a specific deficiency through bloodwork.
  • Medication timing: If you take a statin or diuretic in the evening, ask your doctor whether switching to a morning dose is an option.
  • Iron levels: If your leg discomfort feels more like restlessness than cramping, get your ferritin checked. Many cases of RLS improve with iron repletion alone.
  • Bedroom temperature: Cold muscles cramp more easily. If your bedroom is chilly, wearing loose socks or using a light blanket over your legs can help.

These adjustments are inexpensive and low-risk, making them reasonable to try before pursuing medical workups. But they work best when matched to the right cause: stretching helps cramps, iron helps RLS, and mattress changes help alignment-related pain. Throwing all of them at the problem simultaneously makes it harder to figure out what’s actually working.

Sorting Out Which Cause Applies to You

The character of the pain is the best initial clue. A sudden, gripping contraction that wakes you up and leaves a knot in your calf is almost certainly a cramp. A creeping, restless discomfort that makes you feel like you need to move is more likely RLS. A deep, burning ache in the feet or lower legs that’s worse when lying flat and eases when you dangle your legs over the bed suggests a circulation issue. Diffuse, all-over leg soreness that accompanies profound morning fatigue points toward fibromyalgia or CFS. One-sided swelling with calf tenderness demands same-day medical evaluation for DVT.8PubMed. Diagnosis and Treatment of Lower Extremity Venous Thromboembolism: A Review

For most people, morning leg pain is annoying but not dangerous, and responds to the simple measures described above. If it persists despite stretching, good hydration, and a decent mattress, or if it’s accompanied by skin changes, visible swelling, numbness that doesn’t resolve, or pain that worsens over weeks, bring it to a healthcare provider who can check your circulation, iron levels, and nerve function and narrow down the cause.