Health Conditions A-Z Chronic Pain 13 Causes of Leg Cramps—and How To Stop Them These sudden, involuntary muscle contractions are common and usually harmless, but they can be excruciatingly painful. By Jenna Birch Jenna Birch Jenna Birch is a journalist, dating coach, and author of The Love Gap: A Radical Plan to Win in Life and Love. Jenna is also a co-founder of Plum, a dating app rooted in the social science of relationships. health's editorial guidelines Updated on December 20, 2022 Share Tweet Pin Email Jose Luis Pelaez/Getty Images If you haven't already, you will probably experience leg cramps at some point in your life. They can hit at the worst possible moments; whether you're lying in bed at night or taking a run on the treadmill, that sharp stabbing pain can feel totally debilitating. If leg cramps, also called charley horses, persist, they can become even more irritating, perhaps knocking you off your typical exercise or sleep routine. What Are Leg Cramps? A leg cramp is a sharp, sudden contraction or tightening of the muscle in the calf, which usually lasts a few seconds to a few minutes. If a cramp does hit, you can ease it in the moment by stretching the muscle gently. To keep leg cramps at bay, make sure you're nourishing your body and getting enough rest. To find a long-term solution to leg cramps, however, you might need to take a closer look at their many potential causes. You'll want to rule out any underlying issues that could be contributing to leg cramping, such as peripheral artery disease or thyroid issues. See a healthcare provider when cramps prevent you from exercising, or if they seem to happen spontaneously without a trigger. Experts weigh in on the major reasons you might be experiencing leg cramps, and how you can keep those muscles free of charley horses. Dehydration One of the classic causes of leg cramps is dehydration. "Athletes and avid exercisers deal with cramps all the time," said Mark D. Peterson, PhD, research assistant professor in the department of physical medicine and rehabilitation at the University of Michigan Medical School, "especially during the summer months, in the heat without enough liquid." The reason dehydration causes cramping is largely theoretical, said Todd J. Sontag, DO, family physician with Orlando Health Physician Associates. It may be that fluid depletion causes nerve endings to become sensitized, "triggering contractions in the space around the nerve and increasing pressure on motor nerve endings," Sontag said. This depletion is exacerbated by hot conditions or exercising, since you lose more fluid through sweat. Mineral Deficiency It's not just water that you sweat out. Lost electrolytes, or the essential minerals that affect muscle function and many other important body functions, can also contribute to leg cramping. If you're low in certain minerals, that imbalance can trigger cramping. An imbalance in sodium, calcium, magnesium, or potassium could all lead to leg cramping, said Gerardo Miranda-Comas, MD, associate professor of rehabilitation and human performance at the Icahn School of Medicine at Mount Sinai. Sports drinks can help reduce cramps thanks to their electrolyte content. Certain foods can also help. Bananas, sweet potatoes, spinach, yogurt, and nuts are rich in potassium, a muscle-friendly mineral, and may ward off the deficiencies that could cause leg cramps. Pregnancy Pregnancy increases a person's risk for leg cramps. "This is most likely because the odds of magnesium and potassium deficiency are higher during pregnancy," Peterson said. If you're pregnant and experiencing leg cramps, stay hydrated and consider taking a magnesium supplement—with your healthcare provider's approval. Overuse Independent of an exerciser's hydration status, many people experience leg cramping due to overusing a muscle. Straining or overusing a muscle is actually the most common cause of muscle cramping. "If you're going on a long run, or you're doing a boot camp, you might experience cramping later on," Peterson said. "The nervous system is usually the culprit." When the nerves running from the brain and spinal cord down to the muscle become overexcited, you often wind up with an involuntary cramp. Rest and stretching is extra important in these situations. Exercise Intensity When you're trying to kick your routine up a notch—increasing your biking mileage, starting to swim for triathlon training—your muscles aren't automatically used to the new intensity and movement. "Whenever cramps are induced by starting or restarting an exercise, that's usually an indication of 'too much, too soon,'" Dr. Miranda-Comas explained. "Your muscles don't act and respond the same when you jog and sprint, for instance, so any increase in workout volume or intensity can trigger cramps." Fatigue You may be more prone to leg cramps when you're overtired. You might be more lax in your diet or forget to hydrate effectively, or, if your body hasn't had enough time to properly recover from your last bout of exercise, your muscles might already be in rough shape. "Physiologically, when the muscle is fatigued, it's not as synchronized in using nutrients," Dr. Miranda-Comas said. In other words, a tired muscle loses more nutrients than it uses, so it's not functioning at its peak. Nighttime, or nocturnal, leg cramps are common and can also be caused by tiredness. In a study published in the journal PLoS One, about 30% of adults reported experiencing nocturnal leg cramps at least five times a month. "Although there is no one definitive cause [of nighttime leg cramps], they are likely associated with muscle fatigue and nerve dysfunction," Dr. Sontag explained. "There's also research to suggest athletes that underwent higher-than-normal-intensity exercise had an increase in the incidence of nocturnal leg cramps." Sitting or Standing Muscles were made to move, contract, and rest, so if you're doing anything out of the ordinary—sitting at a conference all day, standing in line at an amusement park—you might experience some leg cramping. Standing for a prolonged period of time can understandably contribute to muscle fatigue, which in turn can cause cramping, Dr. Sontag said. But too much sitting isn't necessarily better. Prolonged sitting "may predispose the muscles to malfunction," Dr. Sontag explained, as the muscle fibers may become hyperactive. When the muscle is being used and can't relax, you end up getting a cramp. If you get leg cramps from standing, make sure to take a seat before your muscles feel too tired. And if you cramp from sitting for long periods of time, try to spend at least a couple of minutes walking around per hour that you're seated. Medications If there's no obvious cause of your leg cramps, then you might want to take a look at any recent additions to your medication list, Dr. Sontag said. Diuretics, a class of medications used to lower blood pressure, may trigger cramps because they deplete the body of fluid and salts, Dr. Sontag explained. Other medications that may cause leg cramps include: Raloxifene and teriparatide (used to treat osteoporosis) Intravenous iron sucrose (used to treat anemia) Conjugated estrogens (used to treat menopause symptoms) Naproxen (used to treat pain) Commonly prescribed statins are also associated with muscle cramps in general, Dr. Sontag added. Talk to your healthcare provider if you started taking a new medication at the onset of your leg cramps; Dr. Sontag said they are usually able to find an alternative medication. Peripheral Artery Disease If your leg cramps seem spontaneous and not exercise-related, it's important to see your healthcare provider to rule out underlying concerns. Some, for instance, "those that affect how the body moves electrolytes," Dr. Miranda-Comas said, can cause leg cramps. Others, like peripheral artery disease (PAD), when cholesterol clogs blood vessels in the legs, affect blood flow. PAD can trigger cramps since there may not be enough blood getting to the legs. Multiple Sclerosis Leg cramps can also be a symptom of the nervous system disorder multiple sclerosis (MS). Some people with MS experience spasticity, which can include a range of involuntary muscle spasms and twitches, as well as leg cramps. Spasticity might feel like a mild tightness or tingling in the muscles to some people or more severe cramping and pain to others. Left untreated, spasticity can cause frozen or immobilized joints, so talk to your healthcare provider if you notice any symptoms of MS. Osteoarthritis Much like overexcited nerves can cause overuse-related leg cramps, nerves that malfunction for other reasons can lead to cramping too. Osteoarthritis, the most common type of arthritis per the Centers for Disease Control and Prevention (CDC), is usually categorized by stiff and achy joints. But people with the painful condition may also experience muscle spasms and leg pain. These leg cramps are usually linked to osteoarthritis of the spine, which, when severe, could lead to pinched nerves or other nerve damage. Diabetic Peripheral Neuropathy Too-high blood sugar levels in people with type 2 diabetes can lead to damage to the nerves in the legs, feet, arms, and hands called diabetic peripheral neuropathy. This nerve damage often leads to feelings of numbness or tingling, but it can also produce muscle twitching and full-blown leg cramps when the nerves in the legs aren't functioning properly. Diabetes treatment can help prevent any further nerve damage, but a healthcare provider might recommend pain medication or anticonvulsant drugs to tamp down the leg cramps and pain. Hypothyroidism Thyroid conditions may also contribute to leg cramps, Dr. Sontag said. People with hypothyroidism produce too little thyroid hormone which controls how your body uses energy. Some people with hypothyroidism will feel weakness or pain in their muscles, while others might experience leg cramps. Always check with a healthcare provider if you have unresolved leg cramps, especially with adequate nutrition, hydration, and stretching. Was this page helpful? Thanks for your feedback! Tell us why! Other Submit Sources Health.com uses only high-quality sources, including peer-reviewed studies, to support the facts within our articles. Read our editorial process to learn more about how we fact-check and keep our content accurate, reliable, and trustworthy. National Library of Medicine. Charley horse. National Library of Medicine. Muscle cramps. Dietary Guidelines for Americans. Food sources of potassium. Grandner MA, Winkelman JW. Nocturnal leg cramps: Prevalence and associations with demographics, sleep disturbance symptoms, medical conditions, and cardiometabolic risk factors. PLoS One. 2017;12(6):e0178465. doi:10.1371/journal.pone.0178465 Allen RE, Kirby KA. Nocturnal leg cramps. Am Fam Physician. 2012;86(4):350-355. American Heart Association. Symptoms of PAD. National Multiple Sclerosis Society. Spasticity. Centers for Disease Control and Prevention. Osteoarthritis (OA). American Association of Neurological Surgeons. Osteoarthritis. National Institute of Diabetes and Digestive and Kidney Diseases. Diabetic neuropathy. Katzberg H, Kokokyi S, Halpern E, et al. Prevalence of muscle cramps in patients with diabetes. Diabetes Care. 2014;37(1):e17-e18. doi:10.2337/dc13-1163 National Institute of Diabetes and Digestive and Kidney Diseases. Hypothyroidism (underactive thyroid). National Library of Medicine. Hypothyroid myopathy.