RISE Sleep Tracker
One of Apple's Best Apps of 2024
★★★★★
(20,627)
TRY FREE

What Causes Leg Cramps at Night? Causes and Treatments

The cause of most nocturnal leg cramps is unknown, but it could be age, exercise, alcohol, your sleeping position, medication, or a medical condition.
Published
2022-08-01
12 MINS
Reviewed by
Jeff Kahn, M.S., Rise Science Co-Founder
Our Editorial Standards
We bring sleep research out of the lab and into your life. Every post begins with peer-reviewed studies — not third-party sources — to make sure we only share advice that can be defended to a room full of sleep scientists.
Learn more
Updated Regularly
We regularly update our articles to explain the latest research and shifts in scientific consensus in a simple and actionable way.
Person on bed massaging leg at night to relive cramps

You’re finally comfortable in bed and start drifting off when — bam! You’re hit with pain. Your calf muscle tightens, becomes rock solid, and you get a sharp shot of intense pain that feels like it lasts forever. This is nocturnal leg cramps. 

You might expect leg cramps after a long day of hiking or at the finish line of a marathon. But nocturnal leg cramps hit you when you’re peacefully sleeping or just drifting off. 

Not only is the episode of cramping itself distressing, you might be left with leg pain and soreness for hours after. And leg cramps can either keep you from falling asleep in the first place, wake you up in the night, or the anxiety of waiting for them to hit (if they’re a common occurrence) can impact your sleep. And we don’t need to tell you that when your sleep is impacted, everything from your ability to concentrate to your mood to your energy levels are affected the next day. 

Below, we’ll dive into what exactly leg cramps are, what causes them at night, and what you can do about them. 

What are Leg Cramps at Night?

Leg cramps at night, also called nocturnal leg cramps, NLC, or charley horses, are exactly what they sound like: cramps in your legs that happen during the night. 

Your muscle spasms and suddenly contracts. You might feel these cramps in your calves or feet, or less commonly in your thighs or hamstrings. And it can come out of nowhere, even while you’re asleep.  

Cramps usually last for an average of nine minutes and 40% of people have cramp episodes more than three times a week, with an unlucky 6% having at least one episode a day or night.

It is a common condition, with up to 60% of adults saying they’ve had nocturnal leg cramps, but it’s a difficult one to diagnose.

Not only are the causes unknown, symptoms can look similar to other leg-related problems you might have at night. These include restless leg syndrome (RLS), a nerve condition where you get an irresistible urge to move your legs, or periodic limb movement disorder, where your limbs move involuntarily while you’re asleep.

What Are the Symptoms of Leg Cramps?

There’s no clear definition of nocturnal leg cramps. But, according to a 2017 paper that looked at 18 studies, these are the characteristics to diagnose them: 

  • Intense pain
  • Cramps lasting from a few seconds to maximum 10 minutes 
  • Cramps in the calf or foot, rarely in the thighs or hamstrings 
  • Persistent pain after the cramping episode — this could last for hours 
  • Sleep disruption and distress — you might have trouble falling asleep or get woken up in the night. This may be temporary or you may develop severe insomnia

Though nocturnal leg cramps mostly happen at night — the clue’s in the name — 20% of people experience leg cramps while resting during the day, too. 

And while not an official symptom, you may experience tiredness, lack of concentration, and low mood the next day if you regularly have nights where leg cramps keep you up. 

With nocturnal leg cramps, it’s much harder to meet your sleep need — the genetically determined amount of sleep you need each night to be at your best during the day. You can use the RISE app to find out your individual sleep need. RISE users on iOS 1.202 and above can click here to access their sleep need on their Profile.

What Causes Leg Cramps at Night?

Most of the time, the cause of leg cramps is unknown. But there are a few risk factors and possible causes: 

  • Age: Leg cramps are more common in older adults and happen more regularly as you get older. This may be due to your muscles and tendons naturally getting shorter.  
  • Being less physically active: Being sedentary has been linked to leg cramps at night. Again, this could come down to shorter muscle length. 
  • Exercise: Muscle fatigue, repetitive movements in your leg muscles, strenuous activity, and even prolonged standing have been shown to increase nocturnal leg cramps.
  • Sleeping position: Some experts think how you sleep could trigger leg cramps. If your foot is relaxed and stretched away from you, your calf muscle fibers are shortened, leading to nerve stimulation and cramping. 
  • Alcohol: One study found alcohol consumption was linked with nocturnal leg cramps in those over 60. 
  • Nerve damage or dysfunction: This may happen in those with parkinsonism or undergoing cancer treatments.  
  • Pregnancy: 33% to 50% of pregnant people experience leg cramps that may get worse as pregnancy progresses. 
  • Medication: Certain medications may predispose you to leg cramps including oral contraceptives, diuretics, cholesterol-lowering drugs like steroids, statins, nifedipine, intravenous iron sucrose, and raloxifene. 
  • Medical conditions: Underlying health conditions may make leg cramps more likely including motor neuron disease, lumbar canal stenosis, peripheral neuropathy, Parkinson’s disease, thyroid conditions like hypothyroidism, diabetes, peripheral vascular disease, hypokalemia, cirrhosis, kidney disease, osteoarthritis and coronary artery disease. 

Nocturnal leg cramps are not due to a lack of electrolytes, however. 

Richard E. Allen and Karl A. Kirby write in American Family Physician

“The exact mechanism is unknown, but the cramps are probably caused by muscle fatigue and nerve dysfunction rather than electrolyte or other abnormalities.” 

They go on to say that nocturnal cramps haven’t been associated with a lack of things like potassium, sodium, or magnesium. A doctor may not even test your electrolyte levels and may instead focus on other more likely causes. 

Plus, the researchers say nocturnal muscle cramps are not associated with dehydration, either. 

How to Stop Leg Cramps at Night?

Treating night leg cramps is hard as the cause is often not known and research hasn’t found a conclusive treatment option yet. 

The common treatments of nocturnal leg cramps are: 

  • Stretching in the moment: You may be able to relieve a cramping episode by stretching your muscle. If you get cramps in your calves, try extending your leg and bending your foot back, as if trying to point your toes towards you. 
  • Deep tissue massage in the moment: There’s limited proof backing this up, but it’s a harmless strategy you can try at home which may help relieve cramps when they’re happening. 
  • Taking a warm bath or shower: Again, limited evidence, but it’s something you can do when severe cramps hit to try and find relief. 
  • Stretching before bed: One study found stretching before bed reduced both the frequency and the severity of leg cramps at night. However, another study found stretching didn’t reduce leg cramps, so it may not work for everyone. 
  • Exercising before bed: Anecdotal evidence suggests gentle exercise, like a few minutes on a stationary bike or treadmill, before bed could help. Just be sure to make it low intensity as exercising before bed can impact your sleep
  • Exercising in general: As a sedentary lifestyle may contribute to leg cramps, be sure to get enough exercise. 
  • Taking breaks if you stand for long periods of time: The study about prolonged standing included those who stand for their job. Take breaks if this is you. 
  • Cutting down on alcohol: Alcohol has been linked to leg cramps and it’s not good for your sleep in general. You can learn how alcohol affects your sleep here. 
  • Vitamin E: Results are inconclusive here, too. While one study showed vitamin E didn’t make a difference to leg cramps, another study found it reduced leg cramps from about 10 episodes a month to about three a month. However, this was in patients on dialysis. 
  • Magnesium sulfate: It’s been shown to reduce leg cramps in pregnant women and may be effective in others over a treatment period longer than a month. However, more research needs to be done to confirm and be warned: diarrhea is a side effect.  
  • Quinine: Quinine has been shown to reduce the number of nights with cramps by 27.4%. But it comes with potentially life-threatening side effects, so many  experts don’t recommend it as a treatment option. In 1995, the US Food and Drug Administration ordered quinine to not be marketed as a leg cramp treatment. 
  • Speaking to a healthcare professional: They can help to determine if an underlying medical condition or the medication you’re taking is causing your leg cramps. Treating the condition or changing medication could help. 

It won’t stop cramps from happening, but painkillers like ibuprofen can help with the post-cramp soreness and help you fall back to sleep.

How Can I Sleep With Leg Cramps at Night?

RISE app screenshot reminding you when to get and avoid bright light
The RISE app can remind you when to do 20+ sleep-hygiene habits.

As well as trying some of the methods above to ease nighttime leg cramps themselves, there’s something else you can do to improve your sleep – focus on sleep hygiene. 

Sleep hygiene is the healthy sleep habits you can do to help you fall asleep faster and wake up less often in the night. But they’re not just habits you do before bed, sleep hygiene begins the moment you wake up. 

With excellent sleep hygiene, you’re more likely to meet your sleep need — and therefore maximize your next-day energy levels — even if you experience leg cramps at night. 

Here’s what to do: 

  • Get natural light first thing: This sets up your circadian rhythm, or body clock, for the day, making sure you feel sleepy come bedtime
  • Get light during the day: Get as much natural light as you can throughout the day as this will make you less sensitive to artificial light come evening. 
  • Avoid artificial light before bed: Light suppresses the sleep hormone melatonin in our bodies. Dim the lights and put on blue-light blocking glasses 90 minutes before bed.
  • Cut off caffeine, exercise, large meals, and alcohol at the right times: All four disrupt your sleep. Check RISE to see when you should avoid these for the rest of the day according to your individual circadian rhythm. 
  • Make time to unwind before bed: This will help you slow down and destress before sleep. Plus, if anxiety about leg cramps is keeping you up, engaging in relaxing activities like reading, listening to music, or journaling may help. 
  • Make your bedroom cool, dark, and quiet: Aim for 65 to 68 degrees Fahrenheit, use blackout curtains, and wear an eye mask and earplugs. If you wake up in the night with leg cramps, try to either keep the lights off or keep them as dim as possible to make it easier to fall back to sleep. 

RISE can remind you to do 20+ sleep hygiene behaviors and tell you when exactly you should do them based on your circadian rhythm. 

The timing of your circadian rhythm (the roughly 24-hour cycle that dictates things like energy levels) can change slightly each day based on things like how long you slept for the night before. RISE works this out for you and shows you a handy prediction. The app then tells you when to limit caffeine or have your last meal for the day, for example.

Plus, you can check RISE to check your Melatonin Window each night. This is the roughly one-hour window of time when your rate of melatonin production peaks. Go to bed in this window and you’ll have an easier time falling and staying asleep, something you want to prioritize if leg cramps disturb you regularly. RISE users on iOS 1.202 and above can click here to set up their Melatonin Window notification.

Get to the Bottom of Leg Cramps 

Leg cramps during the day aren’t fun, but at night they can easily keep you up, meaning your productivity, mood, and energy levels all take a hit the next day. Plus, if your sleep is regularly being impacted, you’ll be doing some serious health damage. 

As well as trying out some of the treatments or speaking to a doctor, keep in mind sleep hygiene. Use RISE to find out your unique sleep need and time 20+ sleep hygiene behaviors to your circadian rhythm. 

By improving your sleep hygiene, you can give yourself the best chance of meeting your sleep need on nights without cramps and make the most of the sleep you do get when they hit. All this leads to better nights, and therefore better days.

What else is keeping you from low sleep debt?

Summary FAQs

What are you lacking if you get leg cramps at night?

You may not be lacking anything. Research suggests a lack of electrolytes isn’t associated with leg cramps at night and more research needs to be done to see if magnesium, vitamin E, or calcium salt supplements could help.

What can I do to prevent severe leg cramps at night?

To prevent severe leg cramps at night, try stretching before bed, getting enough exercise, limiting alcohol, and taking breaks if you stand for long periods of time at work. Speak to a doctor about treatment options or changing your medication.

How do you stop excruciating leg cramps?

Stop excruciating leg cramps by stretching the affected muscle. For example, to do a calf stretch, extend your leg and stretch your foot up as if you’re trying to point your toes towards you. Massaging the muscle may also help.

Can leg cramps be a sign of something serious?

Leg cramps can be a sign of medical conditions like motor neuron disease, Parkinson’s disease, hypothyroidism, diabetes, peripheral vascular disease, hypokalemia, and coronary artery disease. But the cause of most leg cramps is unknown.

Try 7 days free

The power behind your next best day

RISE makes it easy to improve your sleep and daily energy to reach your potential

App store icon

Sleep Hygiene

View all
Try 7 days free

The power behind your next best day

RISE makes it easy to improve your sleep and daily energy to reach your potential

RISE app iconApp store icon