If painful leg cramps wake you up in the middle of the night, you’re not alone—far from it. Up to 60% of adults say they’ve experienced leg cramps at night, according to a 2012 study in American Family Physician.
These ill-timed charley horses usually affect the calf and foot, although they can also strike your hamstring. And while most adults have experienced them, these cramps appear to be more common after age 50, shows a 2017 study in BMC Family Practice.
While this condition is widespread, its causes and remedies are far from certain.
“You will find plenty of disparate opinions, but the simple truth is that nobody really knows why these [leg cramps] occur,” says Scott Garrison, MD, PhD, an associate professor of family medicine at the University of Alberta who has published multiple studies on nocturnal leg cramps.
But there are theories.
Possible causes of leg cramps
Some researchers have theorized that our modern lifestyle is to blame. While our ancient ancestors spent lots of time squatting—a position that stretches leg tendons and muscles—contemporary life has mostly removed the need for squatting.
Other experts have observed that, when we lie in bed, our foot is often in a “plantar flexion” position—meaning the toe points away from us, shortening the calf muscles. When the foot rests in this position for long periods, even small movements of your feet could trigger a cramp, they say.
Garrison’s own research has shown nighttime leg cramps are more common in summer than in winter. While not true for everyone, the frequency of these cramps tends to peak in mid-July and crater in mid-January, his research shows.
Why? It’s important to understand that these muscle cramps are caused by nerve issues—not muscle disorders, Garrison says. Electromyogram tests have shown that nerves running from the spine down to the calf trigger these cramps.
So why summer? “Nerve growth and repair might be more active in summer because of the greater vitamin D levels,” Garrison explains. Your body produces vitamin D (one of these essential vitamins you need after 40) from sun exposure. And so in summer, when your D levels are peaking, your body may engage in “sped up” neural repair, which could trigger these cramps, he says.
There are many other theories. People tend to exercise and sweat more in summer than in winter. So dehydration or physical activity could also (or alternatively) be triggers, Garrison says.
Your diet, meds, or standing habits may also play a role.
There’s evidence—though much of it is mixed—that calcium and magnesium deficiencies play a part in these cramps. There’s also research showing people who spend a lot of time each day standing are more likely to experience these cramps than sitters. Another of Dr. Garrison’s studies links diuretics (high blood pressure meds like Clorpres and Thalitone, for example, have diuretic effects) and asthma drugs (specifically, long-acting beta-adrenoceptors, or LABAs) to a greater risk for nocturnal cramping.
Pregnancy, too, is associated with greater frequency of these cramps. So are diabetes, hypertension, arthritis, respiratory disease, and depression. One case study even blamed a 79-year-old woman’s leg cramps on her habit of eating mangos before bed—which the study authors suspect might have caused a potassium overload.
So yeah, there’s no clear, explanation for these painful spasms. One or several of the above factors—combined with your individual physiology—could explain why you’re waking up in the middle of the night in pain.
And just as the causes are myriad, there are several remedies that may (or may not) work for you.
How to prevent and get rid of leg cramps
There’s some evidence that stretching helps. A small 2012 studyfound people who completed hamstring and calf stretches just before bed enjoyed a 59% drop in spasm frequency. (But a similar studyfrom 2005 found no benefit from stretching.)
Dr. Garrison says that, for many years, quinine pills were the go-to treatment. And while they provided “a modest benefit,” he says, they also caused some dangerous side effects like an irregular heartbeat and too-low blood platelet counts. (Due to the potential side effects, the FDA advises people to steer clear of the drug to treat leg cramps.)
Ensuring you have plenty of magnesium in your diet may help. (Nearly 70% of Americans don’t get enough of the mineral, some studies say.) Beans, nuts, whole grains, and leafy greens are good dietary sources, per the USDA. But another of Garrison’s studies found magnesium didn’t help older cramp sufferers.
You could also try to drink more water during the day—especially if you’re exercising. One small study found taking B vitamins could help, too.