Nighttime foot cramps are most often caused by muscle fatigue, dehydration, electrolyte imbalances, or reduced blood flow, though the exact trigger varies from person to person. They become significantly more common with age: roughly one-third of adults over 60 experience rest cramps, and that number climbs to about half of people over 80.
The involuntary contraction can last a few seconds or several painful minutes, and it tends to strike when you’re lying still in bed. Understanding the most likely causes can help you figure out which one applies to you and what to do about it.
Muscle Fatigue and Inactivity
Exercise research points to muscle fatigue as a primary driver of leg and foot cramps. Studies of endurance athletes show that exercising at a higher intensity than usual is strongly associated with cramping. But the opposite end of the spectrum causes problems too. People who are mostly sedentary can trigger cramps just by straining or doing an unfamiliar physical task during the day, with the spasm showing up hours later at night.
Some researchers have proposed that modern lifestyles contribute to the problem. Repetitive squatting and deep stretching, which were routine in earlier human activity, kept leg tendons and muscles lengthened and flexible. Without that regular stretching, the muscles and tendons in your feet shorten over time, making them more prone to sudden, involuntary contractions when you’re at rest. This is one reason light exercise before bed, even just a few minutes on a stationary bike, can reduce the frequency of nighttime cramps.
Electrolyte Imbalances
Your muscles rely on a precise balance of minerals to contract and relax properly. Four electrolytes play the biggest roles: potassium and magnesium support nerve and muscle function directly, sodium controls fluid levels and helps nerves fire correctly, and calcium helps blood vessels regulate pressure and assists the nervous system in sending signals. When any of these drop too low, your muscles become more excitable and more likely to seize up on their own.
You don’t need a dramatic deficiency for this to happen. Sweating heavily during the day, not drinking enough water, or eating a diet low in fruits, vegetables, and dairy can leave your levels just low enough to tip the balance. Medications that increase urine output are a common culprit here, since they flush electrolytes along with fluid. Vomiting, diarrhea, and heavy alcohol use can also deplete your stores quickly.
Dehydration
Dehydration and electrolyte loss often go hand in hand, but dehydration on its own contributes to cramps. When your body is low on fluid, less blood reaches the smaller muscles in your feet. The reduced circulation makes those muscles more irritable, especially during the long stretch of nighttime when you’re not drinking anything. People who exercise in the evening, live in hot climates, or simply don’t drink enough water throughout the day are more likely to wake up with foot cramps.
Medications That Trigger Cramps
A surprisingly long list of common medications can contribute to nighttime cramps. Diuretics (water pills) are among the most frequent offenders because they deplete both fluid and electrolytes. Statin cholesterol drugs, blood pressure medications including certain beta-blockers and angiotensin receptor blockers, oral contraceptives, and bronchodilators used for asthma are all associated with muscle cramps. Stimulants like caffeine, nicotine, and pseudoephedrine (found in many cold medicines) can also increase muscle excitability.
If your cramps started or worsened after beginning a new medication, that connection is worth exploring with your prescriber. Adjusting the dose or timing can sometimes resolve the issue without switching drugs entirely.
Age-Related Changes
Aging makes foot cramps more likely for several overlapping reasons. Motor neurons, the nerve cells that control muscle movement, gradually decline with age, and this loss is more pronounced in the legs and feet than in the upper body. With fewer motor neurons coordinating muscle fibers, the remaining ones can misfire more easily. Tendons also shorten over time and during prolonged periods of immobility, which increases nerve terminal excitability and lowers the threshold for a cramp to begin.
These structural changes explain why nighttime cramps are relatively rare in younger adults but affect such a large proportion of older people, even those who are otherwise healthy.
Circulation and Nerve Problems
Peripheral artery disease, where narrowed arteries reduce blood flow to the legs and feet, is a well-established cause of muscle cramping. The narrowing typically results from a buildup of fatty deposits on artery walls. In mild cases, cramps happen mainly during walking or exercise. In more severe cases, cramping can wake you from sleep because even resting blood flow is not enough to meet the muscle’s needs.
Nerve damage from diabetes (peripheral neuropathy) is another common contributor. Damaged nerves send erratic signals to foot muscles, triggering involuntary contractions. People with type 1 or type 2 diabetes who notice increasing foot cramps may be experiencing early neuropathy, even if they don’t yet have the classic numbness or tingling.
Spinal stenosis, a narrowing of the spinal canal that compresses nerves running to the legs, can produce similar cramping. The cramps tend to worsen when lying flat, which is why they cluster at night.
Pregnancy
Pregnant women frequently report nighttime foot and calf cramps, particularly in the second and third trimesters. The exact mechanism is not fully understood, but lower levels of calcium in the blood during pregnancy likely play a role. The growing baby draws heavily on the mother’s mineral reserves, and blood volume increases dramatically, diluting circulating electrolytes. Some research suggests that magnesium supplementation can help prevent pregnancy-related cramps, though the evidence is mixed.
Other Contributing Conditions
Several other health conditions are linked to nocturnal foot cramps. Thyroid disorders, both overactive and underactive, disrupt the hormonal signals that regulate muscle function. Chronic kidney disease and dialysis impair the body’s ability to maintain electrolyte balance. Anemia reduces the oxygen supply reaching muscles. Cirrhosis and alcohol use disorder are also recognized contributors, partly through nutritional deficiencies and partly through direct nerve damage.
What Actually Helps
When a cramp strikes, the most effective immediate response is to stretch the affected muscle. For foot cramps, pulling your toes back toward your shin or standing on the cramping foot can force the contracted muscle to release. Massaging the area and applying warmth afterward helps the muscle relax fully.
For prevention, mild exercise before bed has the strongest anecdotal support. A few minutes of walking, cycling, or calf and foot stretches can reduce nerve excitability enough to prevent cramps from firing during sleep. Staying well hydrated throughout the day, not just in the evening, addresses one of the most common and correctable causes. If your diet is low in potassium-rich foods (bananas, potatoes, leafy greens) or magnesium-rich foods (nuts, seeds, whole grains), increasing your intake may help over time.
One treatment to avoid: quinine, once widely used for nighttime cramps, carries serious risks including dangerous blood disorders and heart rhythm problems. The FDA has explicitly warned that quinine is not approved for treating or preventing leg cramps, noting that the risks outweigh any potential benefit. The drug’s label states it “may cause serious side effects or even death” when used for this purpose.

