What Causes Foot Cramps at Night and How to Stop Them

Nighttime foot cramps are caused by involuntary, sustained muscle contractions that happen when your foot and calf muscles shorten during sleep. The most common trigger is the natural position your feet fall into while you’re lying down, but dehydration, mineral deficiencies, certain medications, and pregnancy can all increase your risk. Most people experience these cramps occasionally, but frequent episodes often point to an identifiable and correctable cause.

How Sleep Position Triggers Cramps

When you lie in bed, your feet naturally point downward. This position shortens the muscles in your calves and the arches of your feet, and when a muscle stays shortened for a long time, it becomes more likely to seize up. The contraction locks your foot and toes into that pointed position, producing immediate, intense pain that wakes you from sleep. The muscles feel rock-hard and tender to the touch during the cramp.

This is also why the instinctive fix works: pulling your toes back toward your shin forces the cramping muscle to lengthen, which usually stops the contraction within seconds. Sleeping on your back with heavy blankets pressing your feet downward makes the problem worse, since the blankets hold your feet in that shortened position for hours.

Dehydration Plays a Bigger Role Than You Think

For years, electrolyte imbalances got most of the blame for muscle cramps. But a large study of more than 10,500 Ironman triathletes found a strong link between dehydration and muscle cramps, while finding no evidence that imbalanced electrolytes or abnormal potassium and salt levels were responsible. That finding lines up with other recent research pointing away from electrolytes and toward fluid levels as the more important factor.

The connection likely involves how dehydration affects nerve signaling to muscles. When you’re even mildly dehydrated, your neuromuscular system becomes more excitable, meaning nerves fire more easily and muscles contract when they shouldn’t. Many people go to bed mildly dehydrated without realizing it, especially if they limit fluids in the evening to avoid nighttime bathroom trips, exercise in the afternoon, or drink alcohol or caffeine later in the day.

Mineral Deficiencies That Contribute

Low magnesium is one of the most well-established nutritional causes of muscle cramps. Normal blood magnesium levels fall between 1.46 and 2.68 mg/dL, and when levels drop below that range, muscle spasms, cramps, and numbness in the hands and feet are among the first symptoms. Magnesium helps regulate the signals that tell muscles when to contract and when to relax. Without enough of it, muscles can fire on their own.

Low calcium may also play a role, though the evidence is less clear-cut. Calcium is essential for muscle contraction, and disruptions in calcium balance can make muscles twitch or cramp. People who don’t get enough dairy, leafy greens, or fortified foods, along with those who take certain medications that affect calcium absorption, are at higher risk. Potassium deficiency can contribute too, though it’s less commonly the sole cause of isolated foot cramps.

Medications That Increase Cramp Risk

Several common drug classes are associated with nighttime cramps. Research has found a link between leg cramps and the use of diuretics (water pills), statins (cholesterol medications), and inhaled long-acting bronchodilators used for asthma or COPD. The relationship is complicated, though, because people taking these medications often have underlying conditions like vascular disease that independently raise cramp risk.

Interestingly, diuretics are widely believed to cause cramps by depleting electrolytes, but evidence-based reviews haven’t confirmed that mechanism. The cramps may instead be related to fluid shifts or the underlying conditions being treated. If you started a new medication and noticed cramps appearing or worsening, that timing is worth paying attention to.

Pregnancy and Other Risk Factors

Foot and leg cramps are extremely common during pregnancy, particularly in the second and third trimesters. The exact cause isn’t fully understood, but lower blood calcium levels during pregnancy are one suspected contributor. The added weight, changes in circulation, and shifts in fluid balance all likely play a role as well. Some research suggests that magnesium supplements may help prevent pregnancy-related cramps, though results have been mixed.

Beyond pregnancy, other factors that raise your risk include older age, prolonged standing or sitting during the day, flat feet or other structural foot issues, and starting a new exercise routine that fatigues muscles you haven’t used much. People with nerve damage from diabetes or other conditions also experience nocturnal cramps more frequently, because damaged nerves send erratic signals to muscles.

Foot Cramps vs. Restless Leg Syndrome

These two conditions both strike at night and affect the lower limbs, but they feel completely different. A foot cramp is a sudden, painful contraction. You can feel the muscle seize, and the pain is sharp and localized. Restless leg syndrome, by contrast, produces an uncomfortable urge to move your legs rather than a painful contraction. The sensation is more of a crawling, pulling, or aching feeling that gets worse when you’re still and improves when you get up and walk around.

Cramps wake you with pain; restless legs keep you from falling asleep in the first place. If you’re unsure which you’re dealing with, the key question is whether the sensation involves a hard, visibly contracted muscle. If it does, it’s a cramp.

How to Reduce Nighttime Foot Cramps

Start with the basics: stay well hydrated throughout the day, not just in the evening. Stretching your calves and the bottoms of your feet before bed can help keep those muscles lengthened while you sleep. A simple stretch where you stand on a step and let your heels drop below the edge for 30 seconds targets the right muscle groups.

Keeping blankets loose at the foot of the bed prevents your feet from being pushed into that pointed position all night. Some people use a pillow or footboard to keep blankets off their feet entirely. Sleeping on your side with a slight bend in your knees also keeps the calf and foot muscles in a more neutral position.

If you suspect a magnesium shortfall, foods like nuts, seeds, dark leafy greens, and whole grains are the richest dietary sources. Magnesium supplements are widely available, but absorption varies by form, and too much can cause digestive issues.

One treatment to avoid: quinine. It was once commonly used for leg cramps, but the FDA has issued strong warnings against this use. Quinine can cause life-threatening blood disorders, dangerous heart rhythm changes, severe allergic reactions, and kidney failure requiring dialysis. Fatalities have been reported. The FDA does not consider quinine safe or effective for cramps, and since 2006, multiple efforts have been made to discourage its use for this purpose.

When Cramps Signal Something Deeper

Occasional foot cramps are normal and rarely indicate a serious problem. But cramps that happen most nights, last longer than a few minutes, don’t respond to stretching, or are accompanied by muscle weakness, swelling, or numbness may point to an underlying condition. Peripheral artery disease, nerve damage, thyroid disorders, and kidney problems can all cause persistent cramping. Cramps that consistently affect the same spot or come with visible changes in the skin or muscle deserve a closer look.