What Causes Cramps in Feet and Legs?

Cramps in the feet and legs have several possible causes, ranging from simple dehydration and mineral shortfalls to nerve compression and circulation problems. Most cramps are harmless and resolve on their own, but recurring or severe episodes can point to an underlying condition worth investigating. Understanding the trigger behind your cramps is the first step toward stopping them.

How Muscle Cramps Actually Happen

A muscle cramp is an involuntary contraction that won’t release. Under normal conditions, your muscles contract when they receive a nerve signal and relax when that signal stops. Cramping occurs when something disrupts this cycle, either on the nerve side or the muscle side. One leading explanation focuses on fatigue: when a muscle is overworked, the sensors that monitor its length become overactive while the sensors that tell it to ease off become sluggish. The result is a contraction with no off switch.

Electrolytes play a central role in this signaling. Sodium controls fluid balance and helps nerves fire. Potassium supports the electrical activity in nerves and muscle fibers. Magnesium helps muscles relax after contracting. Calcium regulates blood vessel function and circulation. When any of these minerals drops too low, the communication between nerves and muscles becomes unreliable, and cramps are more likely.

Dehydration and Electrolyte Loss

Sweating, illness, and not drinking enough fluids can all shift your electrolyte balance. But the relationship between hydration and cramping is more nuanced than most people realize. Research published in the Journal of Science and Medicine in Sport found that dehydration alone did not directly trigger cramps in study participants. What did matter was what they drank afterward: plain water after heavy sweating actually made muscles more susceptible to cramping, while beverages containing electrolytes did not. The takeaway is that fluid loss matters most when it dilutes the minerals your muscles depend on. Replacing sweat with water alone can make the problem worse.

Nocturnal Leg Cramps

If your cramps strike at night, you’re far from alone. About 40% of adults over age 50 experience nocturnal leg cramps, and they also affect roughly 7% of children and teens, peaking between ages 16 and 18. These cramps typically hit the calf or the sole of the foot, often waking you from sleep with sudden, intense tightening that lasts seconds to minutes.

The exact trigger for nighttime cramps isn’t always clear. Prolonged sitting or standing during the day, sustained awkward foot positions during sleep, and general muscle fatigue all seem to play a role. For many people, nocturnal cramps are “idiopathic,” meaning no specific medical cause is found. That doesn’t make them less painful, but it does mean they’re usually not a sign of something dangerous.

Exercise and Overuse

Cramps during or after exercise are one of the most common types. They tend to strike muscles that are already shortened or fatigued, which is why calf cramps hit runners late in a race and foot cramps catch swimmers mid-kick. The fatigue theory explains this well: as a muscle tires, the normal balance between “contract” and “relax” signals breaks down. The muscle locks up because the inhibitory signals that would normally force it to release aren’t strong enough to override the excitatory ones.

Starting a new workout routine, exercising in heat, or ramping up intensity too quickly all increase your risk. Muscles that haven’t adapted to a workload fatigue faster, making that signaling imbalance more likely.

Medications That Trigger Cramps

Several common medications list muscle cramps as a side effect. Diuretics (water pills) are a frequent culprit because they flush sodium, potassium, and magnesium out through urine. Blood pressure medications, including certain beta-blockers and angiotensin receptor blockers, can also cause cramping. Other known offenders include cholesterol-lowering statins, asthma inhalers (bronchodilators), and oral contraceptives.

Stimulants deserve a separate mention. Caffeine, nicotine, pseudoephedrine (found in many cold medicines), and stronger stimulants like amphetamines can all increase muscle excitability and lead to cramps. On the flip side, suddenly stopping sedatives like alcohol, barbiturates, or benzodiazepines can also provoke cramping as the nervous system rebounds.

If your cramps started around the same time as a new prescription or a change in dose, that timing is worth discussing with your prescriber.

Poor Circulation and Peripheral Artery Disease

Cramping that reliably shows up when you walk and disappears when you rest has a specific name: claudication. It’s the hallmark symptom of peripheral artery disease (PAD), a condition where fatty deposits narrow the arteries that supply blood to your legs. When you’re sitting still, the reduced blood flow is enough. When you start walking or climbing stairs, your leg muscles need more oxygen than the narrowed arteries can deliver, and painful cramping results.

PAD typically causes cramping in the calves, thighs, or hips, and it often affects one leg more than the other. The pattern is consistent: activity brings the pain, rest relieves it. Risk factors include smoking, diabetes, high blood pressure, and high cholesterol. If your leg cramps follow this pattern, it’s worth getting checked, because PAD is also a marker for heart disease.

Nerve Compression From the Spine

Spinal stenosis, a narrowing of the spinal canal in the lower back, can cause cramping in one or both legs. The mechanism is straightforward: when the space around the spinal cord shrinks, it compresses the nerves that run down into the legs and feet. This compression can produce pain, cramping, tingling, or weakness.

The distinguishing feature of spinal stenosis cramps is their relationship to posture. Standing upright or walking tends to make them worse, while bending forward or sitting down brings relief. This happens because leaning forward opens up a bit more space in the spinal canal, temporarily reducing pressure on the nerves. People with this condition often notice they can walk farther when pushing a shopping cart (which keeps them slightly bent forward) than when walking upright.

Diabetes and Nerve Damage

Chronically high blood sugar damages peripheral nerves over time, a condition called diabetic neuropathy. It affects the feet and legs first, because the longest nerve fibers in the body are the most vulnerable. High blood sugar injures the nerves directly and also weakens the tiny blood vessels (capillaries) that supply those nerves with oxygen and nutrients. The result is nerves that misfire, sending pain and cramp signals without a normal trigger.

Sharp pains and cramps in the feet are among the recognized symptoms of peripheral neuropathy. If you have diabetes and notice increasing foot cramps, especially alongside numbness, tingling, or burning, it may signal that your blood sugar management needs attention.

Pregnancy-Related Cramps

Leg cramps are common during pregnancy, particularly in the second and third trimesters. The exact cause isn’t fully understood, but several factors converge. The growing uterus puts pressure on blood vessels and nerves supplying the legs. Blood volume increases significantly, which can dilute circulating minerals. Some research suggests that lower calcium levels in the blood during pregnancy contribute to cramping. The added body weight and changes in gait also put unfamiliar strain on calf and foot muscles.

What Actually Helps

For an acute cramp, the most effective immediate response is stretching the cramping muscle. For a calf cramp, pulling your toes toward your shin (or standing and pressing your heel into the floor) forces the locked muscle to lengthen. For a foot cramp, grabbing the toes and pulling them back works similarly. Gentle massage and walking around can help the muscle fully release.

For prevention, staying well hydrated with electrolyte-containing fluids matters more than water volume alone. Stretching your calves and feet before bed may reduce nocturnal cramps. Regular, moderate exercise helps condition muscles so they’re less prone to the fatigue-related signaling breakdown that triggers cramps.

Magnesium supplements are one of the most popular remedies, but the evidence is surprisingly mixed. Clinical trials reviewed by the American Academy of Family Physicians found that short courses of magnesium (under 60 days) showed no meaningful difference from placebo for reducing cramp frequency or severity. One larger trial did find a benefit after 60 days of daily magnesium, with cramp frequency dropping from about 5.4 episodes per week to 1.9, compared with 6.4 to 3.7 in the placebo group. So magnesium may help, but only with consistent use over at least two months. It’s also worth noting that 11% to 37% of people taking magnesium supplements experienced digestive side effects like diarrhea.

If your cramps are frequent, worsening, or follow a pattern (only with walking, only at night, only in one leg), that pattern itself is diagnostic information. Circulatory cramps, nerve-related cramps, and simple overuse cramps each behave differently, and matching your symptoms to the right cause is what makes treatment effective.