The pain of a charley horsewhich refers to any cramp or involuntary spasm of a muscleis triggered by the spasm and balling up of your muscles, says Michael Jaffee, M.D., neurologist at the University of Florida Health.

"This can last from seconds to minutes, with an average of nine minutes, followed by several hours of soreness and possible discomfort for two to three days," he says.

If you suffer from leg cramps, you're not alone. About 60 percent of Americans report having nocturnal leg cramps, according to the American Academy of Family Physicians.

So what causes them to happen in the first place, and how can you avoid them or stop them when they have you in their grips? Here's what top docs have to say about it.

What causes leg cramps at night?

For something so painful, you would think scientists would know what exactly is to blame for your leg cramps. There's no single answer, but there are some theories.

You commonly hear that cramps are caused by dehydration or an electrolyte imbalance. Those might play some sort of role, but it's likely they're likely not the main culprits. New thinking is that it's more of a neuromuscular problem for some reason, your skeletal muscles over-fire and bunch up into what you know as a cramp.

So why does that over-firing happen? Again, cramps haven't given up their secrets yet, but scientists think there's likely there's more than one reason. A few possible reasons your muscles are over-firing and giving you leg cramps:

  • Your muscles are overloaded or fatigued, or just challenged in new ways.
  • There may be structural or mechanical causes, like flat feet or circulation problems, says Christopher Hogrefe, M.D., an assistant professor of orthopedic surgery at Northwestern Medicine. Theres also been a link between leg cramps and prolonged sitting, or sitting in an awkward positionwhich might be messing with the circulation in your legs.
  • Your meds could be triggering leg cramps. "Some medications, including diuretics, asthma medications, and statins for cholesterol have also been believed to cause them," says Dr. Hogrefe.
  • Leg cramps may be linked to more serious problems including muscle disease (myopathies), nerve disease (neuropathies), motor neuron disease (ALS), and Parkinsons disease, says Dr. Jaffee.

Weirdly, cramps do seem to be a little bit seasonal: A 2015 study from the University of Alberta found that leg cramp symptoms doubled in the summer.

Pain in the calf muscle
Pain in the calf muscle
BusinessInsider USA Images

How to stop leg cramps

Even if experts don't quite know why you get a charley horse, they do have some recommendations on what to do about it so you can relieve the pain and get on with your life (or sleep).

Stretch away leg cramps

"You should forcefully stretch the affected muscle. For calf spasm or charley horse, point the toes of the affected leg toward your head while keeping the knee extended," says Dr. Jaffee.

Take a bath

Other measures for relief might include a change in temperature such as a hot shower or bath or an ice bath.

Consider pickle juice or capsaicin

A 2010 study found that drinking pickle juice within 35 seconds of the start of leg cramps reduced them 40 faster than drinking water did. While many people think the sodium in that juice is responsible for the effect, says Nicole Nelson, adjunct instructor in clinical and applied movement sciences at Brooks College of Health at the University of North Florida, but relief comes too quickly for sodium to have been absorbed in your system, she explains. (Check out her tips for avoiding and chasing toe cramps , too.)

This might be because pickle juice triggers a reflex in the region in your throat, reducing the neurons involved in cramping muscles. Capsaicinthe stuff that puts the hot in hot peppersmay do the same thing when it hits your mouth and throat. While neither feels like a perfect middle-of-the-night food or drink, science has found that they may help, so it might just be a matter of how badly you want to get rid of them.