Medical Disclaimer: The content on this page should not be taken as medical advice or used as a recommendation for any specific treatment or medication. Always consult your doctor before taking a new medication or changing your current treatment.

Magnesium is a mineral that is essential for  processes throughout the body , including communication between cells in the nervous system. Sleep is largely controlled by the nervous system, and experts believe that nutrients like magnesium may play a role in sleep health. However, the exact relationship between magnesium and sleep is still being studied.

Despite the unclear relationship between magnesium and sleep, there have been encouraging studies showing that magnesium supplements may improve sleep qualitysleep duration, and benefit people with sleep disorders like insomnia and restless legs syndrome. Future research may clarify the effects of magnesium on sleep as well as the role of magnesium supplements in promoting sleep health.

What is Magnesium?

Magnesium is one of several  electrolytes  in the body. Electrolytes are minerals that the body needs to function properly. Magnesium plays  essential roles  in the production of proteins, bone, and DNA. Magnesium is also important for maintaining blood sugar, blood pressure, and regulating activity in the muscles, nerves, and cardiovascular system.

Magnesium in the body typically  comes from a person’s diet . Additional sources of magnesium include dietary supplements and medicines, including laxatives and over-the-counter remedies for heartburn and indigestion.

Although many people’s diets don’t consistently provide enough magnesium, most people are able to keep the level of magnesium in their body  within normal limits . The kidneys and other tissues normally release excess magnesium into the urine and, in times of low magnesium intake, these tissues can conserve magnesium by reducing the amount that is excreted.

Because much of the body’s magnesium is stored within other tissues, it can be difficult to measure the level of magnesium in a person’s blood. But a blood test for magnesium can help doctors determine if magnesium levels are  dangerously low or high .

Having abnormally low or high magnesium levels is uncommon in the general population. Very low magnesium levels can happen in people with low dietary intake of magnesium, those with long-term excessive use of alcohol, and in people taking certain medications. Symptoms of abnormally low levels of magnesium  include :

  • Weakness
  • Muscle spasms
  • Abnormal heart rhythms
  • Nausea and vomiting
  • Sleepiness
  • Personality changes
  • Seizures

People at higher risk for elevated levels of magnesium include those with kidney failure, which prevents the body from properly filtering out and releasing excess magnesium.

Foods with Magnesium

The Recommended Dietary Allowances for magnesium varies depending on age, sex, pregnancy, and whether a person is breastfeeding. For healthy adults over 18 years of age, experts recommend a daily magnesium intake between  310 and 420 milligrams .

Chart of foods containing higher magnesium content
Chart of foods containing higher magnesium content

There are many ways to get adequate magnesium in the diet. Some examples of foods rich in magnesium include:

  • Green leafy vegetables
  • Fish
  • Legumes
  • Whole grains
  • Pumpkin seeds
  • Chia seeds
  • Almonds
  • Cashews
  • Fortified breakfast cereals
  • Soy and soymilk
Rest Support Supplements

Better Sleep Starts Here

Try our proprietary bi-magnesium rest support formula. Its research-backed, clinically-studied ingredients are made to relax your mind and body for restful sleep.

Shop at

How Magnesium Impacts Sleep

Magnesium is included in a variety of nutritional supplements and natural sleep aids. Despite claims that magnesium can improve sleep, few studies have investigated this link. Researchers hypothesize that magnesium may relax the central nervous system and cause  chemical reactions  in the body that increase sleepiness.

Studies suggest that magnesium supplements might help to reverse age-related changes in sleep often seen in older adults. Healthy magnesium levels may have an important role in the development of baby and infant sleep cycles. In contrast, low magnesium could be associated with poor sleep quality.

Magnesium and Insomnia

Insomnia is impaired sleep that causes fatigue and daytime sleepiness. Insomnia can also lead to struggles with memorymental health concerns, and a higher risk for accidents. Thus, people with insomnia may turn to supplements like magnesium to help with sleep.

Research is not clear on the role of magnesium supplements in the treatment of insomnia. However, some studies have shown  encouraging findings . One study of older adults with insomnia found that magnesium supplementation at a dose of 500 milligrams daily for eight weeks helped them fall asleep faster, stay asleep longer, reduced nighttime awakenings, and increased their levels of naturally circulating melatonin.

There have also been studies combining magnesium with other supplements that have shown  promising results  for treating insomnia. Yet, because the supplements in these studies contained more than just magnesium, it is difficult to interpret whether the benefits were linked to magnesium, to the other supplements, or to the combination.

Magnesium and Restless Legs Syndrome

Restless legs syndrome is a sleep-related movement disorder that creates an irritating urge to move the legs. The exact cause of this condition remains unclear, but some researchers suggest that magnesium deficiency may play a role in the condition’s development.

Studies have  not demonstrated  a clear relationship between magnesium levels and restless legs syndrome in the general population. However, there is some evidence that magnesium may play a role in restless legs syndrome that develops  during pregnancy  or while  receiving dialysis .

Researchers have also investigated whether magnesium supplementation can reduce the symptoms of restless legs syndrome. Results of these studies are  contradictory . Some have found that magnesium supplementation may be helpful to reduce symptoms in people with restless legs syndrome. But a more recent study of people with many types of cramps, including restless legs syndrome, found  no benefit from  magnesium supplementation.

Other Benefits of Magnesium

Supplemental magnesium may be recommended by a doctor for people with conditions that cause a magnesium deficiency. Magnesium may be given to people who have certain health conditions  such as :

  • Diarrhea
  • Pancreatitis
  • Uncontrolled diabetes

There’s some evidence showing that magnesium supplements may benefit people with certain  chronic conditions  like migraine headaches, high blood pressure, and osteoporosis. But more research is needed to determine how helpful magnesium is in managing these conditions.

Magnesium supplements may also be recommended for people taking medications that can lower magnesium levels, including proton pump inhibitors, diuretics, antibiotics, and some medications used to treat cancer.

Risks of Magnesium

In most cases, magnesium supplements are safe. A dangerously high level of magnesium is rare in otherwise healthy people unless they take a  very high dose  of magnesium.

Symptoms of magnesium toxicity can range from mild to severe, and vary depending on a person’s magnesium level. Symptoms of excessive magnesium include:

  • Nausea
  • Headache
  • Drowsiness
  • Low blood pressure
  • Muscle paralysis
  • Cardiac arrest

Magnesium is also included in over-the-counter products such as Epsom salts, antacids, or laxatives. The risk of magnesium toxicity from using these products is higher in people who have impaired kidney function. Other risk factors for magnesium toxicity include conditions that increase the absorption of nutrients, such as colitis, gastritis or gastric ulcer disease.

Magnesium vs. Melatonin

Melatonin and magnesium supplements are both used to improve sleep, but they work in different ways in the body. Melatonin is a sleep hormone that the pineal gland in the brain produces when the time to sleep is approaching. Experts note that adding supplemental melatonin may help people fall asleep but may be less helpful for staying asleep all night.

Magnesium may help to quiet the nerves in the body that keep people awake. However, while experts recommend melatonin for treating some sleep disorders, magnesium may not be something that a doctor recommends unless a person has another reason to take it, such as evidence of low magnesium levels.

How to Use Magnesium for Sleep

Overall, the evidence for magnesium on insomnia and other sleep disorders remains mixed. However, some evidence shows that otherwise healthy people may benefit from low doses of oral magnesium supplements to help improve symptoms of insomnia. Research suggests doses of up to one gram of magnesium should be taken no more than three times daily.

While magnesium supplements are generally considered safe, there are some people who are at a higher risk for magnesium toxicity or harmful drug interactions. Therefore, before purchasing a magnesium supplement, talk to a health care provider first to find out if taking magnesium is safe and warranted.

Related News
Thanks for the feedback - we're glad you found our work instructive!

Thanks for the feedback - we're glad you found our work instructive!

Submitting your Answer...

Learn more about our Editorial Team

19 Sources

  1. MedlinePlus: National Library of Medicine (US). (2015, April 2). Magnesium., Retrieved November 1, 2022, from
  2. Gragossia, A., Bashir, K., & Friede, R. (2022, May 15). Hypomagnesemia. In StatPearls. StatPearls Publishing., Retrieved November 1, 2022, from
  3. National Institutes of Health Office of Dietary Supplements. (2021, March 22). Magnesium: Fact sheet for consumers., Retrieved November 1, 2022, from
  4. Lewis J. L. (2021, September). Overview of disorders of magnesium concentration. Merck Manual Professional Version., Retrieved November 1, 2022, from
  5. Cascella, M. & Vaqar, S. (2022, May 30). Hypermagnesemia. In StatPearls. StatPearls Publishing., Retrieved November 1, 2022, from
  6. Lewis J. L. (2021, September). Hypermagnesemia. Merck Manual Professional Version.
  7. Yu, A. S. L. & Yarlagadda, S. G. (2021, October 27). Hypomagnesemia: Clinical manifestations of magnesium depletion. In M. Emmett & R. H. Sterns (Eds.). UpToDate., Retrieved November 1, 2022, from
  8. National Institutes of Health Office of Dietary Supplements. (2022, June 2). Magnesium: Fact sheet for health professionals., Retrieved November 1, 2022, from
  9. Schwalfenberg, G. K., & Genuis, S. J. (2017). The importance of magnesium in clinical healthcare. Scientifica, 2017.
  10. Mah, J., & Pitre, T. (2021). Oral magnesium supplementation for insomnia in older adults: A systematic review & meta-analysis. BMC Complementary Medicine and Therapies, 21(1), 1-11.
  11. Djokic, G., Vojvodić, P., Korcok, D., Agic, A., Rankovic, A., Djordjevic, V., Vojvodic A.,Vlaskovic-Jovicevic, T., Peric-Hajzler, Z.,Matovic, D., Vojvodic, J., Sijan, G., Wollina, W., Van Thuong, N., Fioranelli, M., & Lotti, T. (2019). The effects of magnesium–melatonin-vit B complex supplementation in treatment of insomnia. Open Access Macedonian Journal of Medical Sciences, 7(18), 3101.
  12. Chen, P., Bornhorst, J., Patton, S., Bagai, K., Nitin, R., Miah, M., Hare, D.J., Kysenius, K., Crouch, P. J., Xiong, L., Rouleau, G. A., Schwerdtle, T., Connor, J., Aschner, M., Bowman, A. B., & Walters, A. S. (2021). A potential role for zinc in restless legs syndrome. Sleep, 44(4), zsaa236.
  13. Yıldırım, E., & Apaydın, H. (2021). Zinc and magnesium levels of pregnant women with restless leg syndrome and their relationship with anxiety: A case-control study. Biological Trace Element Research, 199(5), 1674-1685.
  14. Yang, Y., Ye, H., He, Q., Zhang, X., Yu, B., Yang, J., & Chen, J. (2019). Association between predialysis hypermagnesaemia and morbidity of uraemic restless legs syndrome in maintenance haemodialysis patients: A retrospective observational study in Zhejiang, China. BMJ open, 9(7), e027970.
  15. Hornyak, M., Voderholzer, U., Hohagen, F., Berger, M., & Riemann, D. (1998). Magnesium therapy for periodic leg movements-related insomnia and restless legs syndrome: an open pilot study. Sleep, 21(5), 501-505.
  16. Garrison, S. R., Korownyk, C. S., Kolber, M. R., Allan, G. M., Musini, V. M., Sekhon, R. K., & Dugré, N. (2020). Magnesium for skeletal muscle cramps. Cochrane Database of Systematic Reviews, (9).
  17. Yu, A.S. (2022, January 12). Hypomagnesemia: Causes of hypomagnesemia. In M. Emmett & R. H. Sterns (Eds.). UpToDate., Retrieved November 1, 2022, from
  18. Volpe, S. L. (2013). Magnesium in disease prevention and overall health. Advances in Nutrition, 4(3), 378S-383S.
  19. Yu, A. S. (2022, May 19). Hypermagnesemia: Causes, symptoms, and treatment. In M. Emmett & R. H. Sterns (Eds.). UpToDate., Retrieved November 1, 2022, from

Learn More About Sleep Aids

Natural Sleep Aids

By Eric Suni April 12, 2023

CBD as a Sleep Aid

By Danielle Pacheco April 12, 2023

Sleep Aids

By Eric Suni April 6, 2023

Compare Sleep Aids

By Eric Suni April 6, 2023

Finding Reputable Sleep Supplements

By Jay Summer March 23, 2023

Over the Counter Sleep Aids

By Danielle Pacheco March 20, 2023

Side Effects of Sleep Medication

By Danielle Pacheco March 17, 2023

CBN for Sleep

By Danielle Pacheco March 17, 2023

Valerian Root for Sleep

By Jay Summer March 17, 2023