Leg cramps happen when a muscle suddenly contracts and won’t relax, most often in the calf. The sensation can last a few seconds or several minutes, and it tends to strike at night or after physical activity. While most leg cramps are harmless, they have a surprisingly wide range of triggers, from dehydration and mineral imbalances to medication side effects and circulation problems.
What Happens Inside a Cramping Muscle
Your muscles contract and relax through a tightly coordinated electrical system. Nerve signals travel from your spinal cord to motor neurons, which tell muscle fibers when to fire. During normal movement, two feedback systems keep things balanced: one set of sensors (in your muscle spindles) promotes contraction, while another set (in your tendons) promotes relaxation. When that balance tips, the contraction signal overwhelms the relaxation signal, and the muscle locks up.
Current research points to the spinal cord, not the muscle itself, as the source of the problem. Fatigue appears to be the trigger: as a muscle tires, the excitatory signals ramp up while the inhibitory signals fade. The result is a sustained, involuntary contraction. This explains why cramps tend to hit muscles you’ve been using hard or holding in a shortened position for a long time, like your calves while you sleep with your feet pointed downward.
Dehydration and Electrolyte Imbalances
Your muscles depend on a precise balance of sodium, potassium, and calcium to generate electrical signals. Tiny pumps on the surface of every muscle cell constantly shuttle sodium out and potassium in, maintaining the voltage difference that allows a muscle to fire on command. When you’re dehydrated or low on these minerals, those pumps can’t keep up with the demand, especially during exercise. The electrical gradients destabilize, and the muscle becomes hyperexcitable.
This is why cramps are more common in hot weather, after intense workouts, or during illness that causes vomiting or diarrhea. Anything that shifts your fluid or mineral balance can set the stage. Diets low in potassium-rich foods (bananas, potatoes, leafy greens) or calcium sources (dairy, fortified alternatives) may contribute over time, though a single deficiency rarely explains chronic cramping on its own.
Does Magnesium Actually Help?
Magnesium supplements are one of the most popular remedies for leg cramps, but the evidence is weaker than most people expect. A large Cochrane review pooling multiple clinical trials found that magnesium supplements did not significantly reduce cramp frequency compared to a placebo in older adults with nocturnal leg cramps. Across five studies involving 307 participants, the difference was less than one cramp per week. The proportion of people who experienced a meaningful reduction in cramp frequency was also no different between the magnesium and placebo groups.
For pregnancy-related cramps, the picture is muddled. Of three trials comparing magnesium to placebo in pregnant women, one found benefits, one found none, and one produced results that couldn’t be reconciled. If you’re already low in magnesium, supplementing may help restore normal levels, but taking extra magnesium when your levels are fine is unlikely to stop cramps.
Medications That Cause Leg Cramps
A surprisingly long list of common medications can trigger or worsen leg cramps. The most well-known culprits include:
- Diuretics (water pills): These increase urine output, flushing sodium and potassium from your body and disrupting the mineral balance muscles need.
- Cholesterol-lowering statins: Muscle complaints, including cramps, are a recognized side effect.
- Blood pressure medications: Certain beta-blockers and angiotensin receptor blockers list cramps as a side effect.
- Birth control pills: Hormonal contraceptives can contribute to cramping.
- Stimulants: Caffeine, nicotine, pseudoephedrine (found in many cold medicines), and amphetamines all increase the likelihood of cramps.
- Asthma inhalers (bronchodilators): These can affect muscle excitability.
If your cramps started or worsened after beginning a new medication, that connection is worth discussing with your prescriber. In many cases, a dosage adjustment or alternative drug can make a noticeable difference.
Cramps During Pregnancy
Leg cramps are common during pregnancy, particularly at night during the second and third trimesters. The exact cause isn’t fully understood, but the likely contributors include the extra weight compressing blood vessels and nerves in the legs, shifting fluid balance, and increased demand for minerals like calcium and magnesium as the baby grows. The cramps almost always resolve after delivery.
Cramps That Come With Age and Inactivity
Older adults experience leg cramps more frequently for several overlapping reasons. Muscle mass naturally declines with age, meaning the remaining muscle fibers fatigue more quickly. Chronic conditions like diabetes, kidney disease, and thyroid disorders become more common and can directly affect nerve and muscle function. Peripheral neuropathy, where nerves in the legs are damaged, creates abnormal firing patterns that trigger cramps. Even simply being less active during the day reduces blood flow and leaves muscles more prone to spasms at night.
People who sit for long periods or have a sedentary lifestyle are also at higher risk regardless of age. Regular movement keeps the sodium-potassium pumps in your muscle cells active and maintains the blood flow that delivers oxygen and clears waste products from working tissues.
When Cramps Signal Something Else
Most leg cramps are benign, but certain patterns deserve attention. Peripheral artery disease (PAD) causes cramping in the calves, thighs, or hips that reliably appears during walking and fades with rest. This type of pain, called claudication, results from narrowed arteries that can’t deliver enough blood to meet the muscle’s demand during activity. Other signs of PAD include cold feet, slow-healing sores on the legs or feet, shiny skin on the legs, slow toenail growth, and hair loss on the lower legs.
Deep vein thrombosis (DVT), a blood clot in a leg vein, can also mimic a cramp or charley horse. The key differences: DVT typically causes swelling in one leg, reddish or bluish skin discoloration, and warmth to the touch in the affected area. A standard muscle cramp produces intense pain but not visible swelling or color changes. If you notice those additional symptoms, especially after prolonged sitting, surgery, or travel, seek medical evaluation promptly.
How to Stop a Cramp in the Moment
When a calf cramp strikes, straighten your leg and pull the top of your foot toward your shin. This stretches the calf muscle and signals the tendon sensors to override the contraction. You can also stand up and press your weight firmly through the cramping leg, which achieves the same stretch. Gently massaging the muscle while stretching helps it release faster. Applying a warm towel or heating pad afterward can ease the lingering soreness that sometimes follows a severe cramp.
Reducing Cramp Frequency
Staying well hydrated is the simplest starting point, particularly if you exercise, work in heat, or take diuretics. Stretching your calves before bed (standing on a step and letting your heels drop below the edge for 30 seconds) can reduce nighttime cramps. Regular physical activity, even daily walking, keeps muscles conditioned enough to resist the fatigue that triggers spasms.
Pay attention to your sleeping position. Sleeping with heavy blankets that push your feet into a pointed position shortens the calf muscles for hours, making them more cramp-prone. Letting your feet hang off the bed or using a loose blanket can help. If you notice a pattern with specific foods, medications, or activities, tracking your cramps in a simple log for a few weeks often reveals a trigger that’s easy to address once you see it.

