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

Magnesium for Leg Cramps at Night: Does It Really Work?

Published
2024-06-14
Updated
Written by
Jeff Kahn
Reviewed by
Dr. Chester Wu
Woman suffering from leg cramps at night

Key Takeaways

  • Magnesium may help with leg cramps at night, but much more research is needed. Studies have mixed results and rarely look at the general population.
  • Studies show that magnesium can reduce the severity and frequency of leg cramps for some people — like pregnant women. But there’s also research showing it’s not effective for others. 
  • The RISE app can help you get the best sleep possible while you’re treating your leg cramps and beyond. RISE guides you through 20+ sleep hygiene habits proven to help you fall asleep faster and wake up less often, making sure nothing else disrupts your sleep.

Leg cramps can be painful at any time of day or night, but nocturnal leg cramps come with the added pain of losing out on sleep. If you have them, you’re not alone, up to 60% of us have had nocturnal leg cramps.  

Magnesium supplements may help, but the science is mixed.

Below, we dive into what we know about magnesium for leg cramps at night. Plus, we cover how the RISE app can help you fall and stay asleep while you’re treating your leg cramps — and beyond.

Advice From a Sleep Doctor

“The research on magnesium for leg cramps isn’t conclusive,” says Dr. Chester Wu. “Magnesium may reduce leg cramps for some, like pregnant women, but it might not help everyone. Try stretching, exercising, and cutting down on alcohol to reduce leg cramps, and speaking to your healthcare provider about whether magnesium could help.”

Dr. Chester Wu is double board certified in Psychiatry and Sleep Medicine, and provides sleep medicine services, medication management, and psychotherapy to adults at his private sleep medicine and psychiatry practice.

Does Magnesium Help Leg Cramps at Night? 

It’s unclear if magnesium can help leg cramps at night. Some studies show that it can, but other studies show that it can’t. Studies on magnesium and leg cramps are often done on certain populations — like pregnant women or older adults — so it’s unclear if magnesium can help the general population with leg cramps. 

Plus, studies have conflicting results, are small, and use different doses and types of magnesium — including oral magnesium and intravenous infusions — making it hard to draw any solid conclusions.

Many studies also don’t check participants’ baseline levels of magnesium, so we don’t know if having a magnesium deficiency makes a difference.

Whether magnesium can help you may depend on: 

  • Whether you have a magnesium deficiency
  • What type and how much magnesium you take
  • What’s causing your leg cramps 
  • Whether you have any health conditions 

Here’s a round-up of some of the research. 

Magnesium May Help Leg Cramps for Some

A 2021 study had 175 participants take 226 milligrams (mg) of magnesium oxide monohydrate or a placebo daily for 60 days. 

Both groups saw a reduction in the number of nocturnal leg cramp episodes they had, but the magnesium group saw a larger reduction. 

The magnesium group also saw a greater reduction in leg cramp duration and an improvement in sleep quality. 

Magnesium May Help Pregnancy Leg Cramps 

A 2012 study looked at 80 pregnant women with leg cramps. About half took 300 mg of magnesium bisglycinate chelate daily for four weeks and the other half took a placebo.

More people in the magnesium group had a 50% reduction in leg cramp frequency and a 50% reduction in cramp intensity compared to the placebo group.

A 2014 systematic review and meta-analysis looked at seven studies including 361 people in total. It concluded that magnesium doesn’t appear to help nocturnal leg cramps in the general population, but it may have “a small effect in pregnant women.”

Magnesium May Not Help Everyone 

A 2020 review looked at 11 randomized controlled trials on magnesium and skeletal muscle cramps including more than 700 participants in total. It concluded that magnesium was unlikely to reduce cramps in older adults, people with liver cirrhosis (liver scarring), and in some pregnant women. 

Improvements May Be Down to the Placebo Effect 

An older study from 1999 looked at 42 participants with nocturnal leg cramps. Participants took 900 mg of magnesium citrate twice a day for a month and then a placebo for a month, or vice versa.  

Participants’ leg cramps improved over time regardless of the treatment they received. The researchers said this was due to a combination of the placebo effect and cramps naturally getting better over time.

Newer research has similar findings.

In a 2017 study, 88 older adults took either 865 mg of magnesium oxide or a placebo daily for four weeks. At the end of the experiment, there was no difference between the magnesium group and the placebo group. 

Leg cramps slightly improved in both groups, but the researchers said the beneficial effect of magnesium could be due to the placebo effect again. 

Magnesium May Improve Your Sleep Outside of Leg Cramps 

As with everything magnesium, more research is needed. But magnesium supplements may help you get better sleep in general or improve medical conditions or sleep disorders that disrupt your sleep. 

Magnesium may help people with: 

  • Insomnia
  • Restless leg syndrome for some
  • Night sweats for some
  • Anxiety 
  • Depression 
  • Low energy 

We’ve covered how magnesium can make you tired and sleepy here.

Heads-up: Nocturnal leg cramps and restless leg syndrome are similar conditions, but they’re not quite the same.

  • Nocturnal leg cramps: These are sudden painful cramps that can happen in the calf muscle and sometimes the thighs or feet at night. They can last a few seconds to 10 minutes, and you might feel lingering pain afterward that lasts for hours.
  • Restless leg syndrome (RLS): RLS is a nerve condition that causes an uncontrollable urge to move your legs, especially in the evening or at night. You might feel a crawling or tingling sensation and moving your legs temporarily makes it go away.

Magnesium may help RLS. We’ve covered more on magnesium for restless leg syndrome here.

{{ cta }}

How Much Magnesium Should I Take for Leg Cramps at Night?

There isn’t a recommended amount of magnesium to take for leg cramps at night as it’s unclear if magnesium can help reduce leg cramps. 

For sleep in general, Dr. Wu recommends:

  • 400 to 500 mg of magnesium oxide
  • 250 to 500 mg of magnesium citrate
  • 200 to 400 mg of magnesium glycinate

Start with a low dose and slowly increase if needed and if you’re not experiencing any side effects.

In research on leg cramps, the amount of magnesium taken can be high, but this can’t be taken as a guideline for the general public. Studies are done in controlled environments, under medical supervision, and may use high doses to find out how effective they could be.    

We’ve covered how much magnesium to take for sleep in general here, including how much to take for depression, anxiety, menopause, and exercise performance.

When Should I Take Magnesium for Leg Cramps at Night? 

There isn’t a recommended time to take magnesium for leg cramps at night as more research is needed to find out if magnesium can help — let alone what time would be best. 

In general, Dr. Wu recommends taking magnesium 30 minutes to one hour before bed. But timing may not be that important, so you can take them earlier if you prefer. 

Instead of timing, it may be more important to remember to take magnesium every day.

To help, RISE can send you a reminder when it’s time to start your bedtime routine, which can include taking magnesium. You can get this reminder on your phone, iPad, or Apple Watch and customize when you’ll get it exactly.

RISE app screenshot reminding you of your evening routine activities
RISE can help you remember to take magnesium before bed.

Why Could Magnesium Help Leg Cramps at Night?

If magnesium helps with leg cramps at night, it's thought to be because magnesium plays a role in nerve and muscle function, aiding in muscle contraction and relaxation. Magnesium also helps transport electrolytes — like calcium and potassium — into your cells. Low magnesium could cause an electrolyte imbalance, which can cause muscle cramps. 

Not everyone agrees electrolyte imbalances or low magnesium can lead to nocturnal leg cramps, though. But low magnesium may play a role for some people. 

For example, a 2009 clinical trial found that low magnesium levels were associated with leg cramps in pregnant women.

Therefore, magnesium supplements could help those with leg cramps caused by low magnesium levels. This could be many of us — nearly 50% of Americans don’t get enough magnesium from food. 

More research is needed, though. Leg cramps aren’t always caused by low magnesium levels. And even if yours are, it’s not clear if increasing your magnesium intake from food could help or if supplements are best.

FYI, foods high in magnesium include: 

  • Leafy green vegetables like spinach 
  • Legumes like lentils, beans, and chickpeas 
  • Nuts and seeds like cashews and pumpkin seeds
  • Whole grains like brown rice, quinoa, and whole-wheat bread  
  • Fortified cereals 

Looking for a sleep supplement? We’ve compared magnesium vs. melatonin here.

{{ cta-mini }}

How to Treat Leg Cramps at Night? 

Magnesium may help treat leg cramps at night, but there are other treatment options you can try alongside or instead of magnesium supplements. 

Here’s what could help: 

  • Stretching: Try stretching your leg muscles to relieve cramp when it hits. There’s also some research showing stretching before bed may reduce the severity and frequency of leg cramps at night, but it may not work for everyone. 
  • Exercise: Exercising in general and doing some gentle exercise before bed may help reduce the chances of leg cramps. Just be sure to avoid vigorous exercise before bed, though, as this could keep you awake. RISE can tell you when it’s best to skip a workout or do gentle exercise. 
  • Cutting down on alcohol: Alcohol has been linked with nocturnal leg cramps in older adults. Cutting down may reduce your chances of cramps and it can help improve your sleep in general, too. Avoid alcohol three to four hours before bed.
  • Speak to your healthcare provider: Vitamin D, vitamin E, and potentially magnesium could help reduce your leg cramps. But research is mixed for all three. Your provider can let you know if they could be safe and effective for you. 

FYI, quinine is no longer recommended as a treatment for leg cramps as it can cause serious adverse effects, including death. The FDA has ordered quinine not to be marketed as a leg cramp treatment.

Expert tip: If you experience leg cramps, you want to make sure nothing else disrupts your sleep and the sleep you get is the best it can be. Improving your sleep hygiene is key. 

Sleep hygiene is the name for the habits that help you fall and stay asleep. They include: 

  • Getting at least 10 minutes of natural light first thing each morning
  • Avoiding bright light about 90 minutes before bed
  • Avoiding caffeine about 12 hours before bed, alcohol three to four hours before bed, and large meals two to three hours before bed
  • Make sure your bedroom is dark, cool, quiet, and relaxing — this last one is especially important if anxiety around leg cramps keeps you up 
  • Wake up and go to bed at the same times each day 

RISE can tell you the best time to do 20+ sleep hygiene habits based on your circadian rhythm, or body clock. This makes them even more effective.

RISE app screenshot of sleep hygiene habit reminders
RISE can tell you when to do daily sleep hygiene behaviors.

Improving your sleep hygiene can help you meet your sleep need — the amount of sleep you personally need. RISE can tell you how much sleep to aim for as it’s not a simple eight hours for everyone. 

For example, among 1.95 million RISE users aged 24 and up, sleep needs ranged from five hours to a whopping 11 hours 30 minutes. 

The RISE app can tell you how much sleep you need
RISE users’ sleep needs.

Magnesium for Leg Cramps: It Might Work for You 

Magnesium supplements may reduce leg cramps at night, but they’re not guaranteed to work for everyone. They may help if you’re pregnant, but get medical advice to make sure they’re safe for you. 

To get the best sleep possible — even with leg cramps — focus on improving your sleep hygiene. RISE can tell you the best time to do 20+ sleep hygiene habits to help you fall and stay asleep.

User says these reminders have improved their nights and days: 

“Just becoming more aware of when’s the best time to drink caffeine, eat dinner, and get sunlight according to my circadian rhythm has helped my sleep quality tremendously…I now sleep better than ever and feel so much more productive throughout the day.” Read the review

And it doesn’t take long — 80% of RISE users get better sleep within five days.

FAQs

About Our Editorial Team

Written by
Jeff Kahn
Medically Reviewed by
Dr. Chester Wu
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.
Updated Regularly
We regularly update our articles to explain the latest research and shifts in scientific consensus in a simple and actionable way.

References

See all references

Sleep better. Sell more.

Learn more about Rise for sales teams.

Thanks! We received your information. You'll hear from us shortly.
Oops! Something went wrong while submitting the form.
About Rise
Rise is the only app that unlocks the real-world benefits of better sleep.

Instead of just promising a better night, we use 100 years of sleep science to help you pay down sleep debt and take advantage of your circadian rhythm to be your best.

Over the past decade, we've helped professional athletes, startups, and Fortune 500s improve their sleep to measurably win more in the real-world scenarios that matter most.

Rise Science is backed by True Ventures, Freestyle Capital, and High Alpha; investors behind category winners Fitbit, Peloton, and Salesforce Marketing Cloud.

Sleep Hygiene

View all
Close Cookie Popup
Cookie Preferences
By clicking “Accept All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts as outlined in our privacy policy.
Strictly Necessary (Always Active)
Cookies required to enable basic website functionality.
Cookies helping us understand how this website performs, how visitors interact with the site, and whether there may be technical issues.
Cookies used to deliver advertising that is more relevant to you and your interests.
Cookies allowing the website to remember choices you make (such as your user name, language, or the region you are in).