When you buy through our links, we may earn a commission. Products or services may be offered by an affiliated entity. Learn more.
Magnesium for Sleep
- Magnesium can help you sleep longer, get better quality sleep, and feel less tired.
- Experts recommend taking no more than 350 milligrams of magnesium for sleep.
- Magnesium can be found in foods like nuts, leafy greens, whole grains, dairy, and soy products.
According to recent studies , nearly 50% of adults and children in the US may not receive enough magnesium. Since magnesium has been found to play a role in sleep, , taking supplements may be a useful sleep aid in helping you get a good night’s rest.
Below, we’ll explore what magnesium is, how it might benefit sleep, and what to look for in a magnesium supplement.
Get to the root of your sleep problems
Magnesium can help, but it’s best to find the source of your sleep issues. Answer these questions to better understand your sleep.
What Is Magnesium?
Magnesium is an essential mineral in the body that plays a role in nerve and muscle function, bone development, blood sugar control, and heart rhythm consistency . Research suggests that magnesium can help with keeping a healthy sleep schedule and getting quality sleep .
To make sure you’re getting enough, you can eat magnesium rich foods like whole grains and leafy greens. If you have dietary restrictions, you can also consult a medical professional about taking dietary supplements. According to recent research from the Recommended Dietary Allowance (RDA), daily magnesium intake falls between 310 and 420 milligrams for adults, depending on age, sex, and pregnancy status.


Does Magnesium Help You Sleep?
A 2021 study found that higher levels of magnesium in the body are associated with better sleep , longer periods of sleep , and less exhaustion during the day. Studies of older adults also found that magnesium supplementation helped with falling asleep faster and even helped with getting them more rest in the morning .
Experts haven’t yet found the exact ways in which magnesium impacts sleep problems. Some evidence suggests that magnesium impacts the way certain chemicals act in the brain, like NMDA, GABA , melatonin , renin , and cortisol , all of which may impact how relaxed or tired a person feels.
Magnesium and Insomnia
A few studies suggest that magnesium supplementation may help with symptoms of insomnia , a disorder that involves trouble falling asleep or staying asleep. However, research is needed to determine how magnesium supplements may impact people of other ages who experience insomnia.
Magnesium and Restless Legs Syndrome
Many people take magnesium supplements for leg cramps and restless legs syndrome, a sleep disorder that causes uncomfortable sensations in the legs that can make it difficult to sleep. Research suggests magnesium may specifically help with nighttime leg cramps during pregnancy, since they may be caused by low magnesium levels.
Lower magnesium levels may also be linked to more severe cases of restless legs syndrome, but more research is needed. Currently, some studies have shown the promise of magnesium when paired with vitamin B6 supplementation to help treat restless legs syndrome.
How to Choose a Magnesium Supplement for Sleep
Since the Food and Drug Administration (FDA) doesn’t regulate dietary supplements, you should always talk to a medical professional before starting any new medications or supplements.
Here are some other factors to keep in mind when choosing the best magnesium supplement:
- Formulation: Magnesium comes in multiple forms, and some may be easier for the body to absorb than others , especially if you have certain dietary restrictions or health conditions. Specifically, types of may be better absorbed because they have higher bioavailability. When a supplement is better absorbed, it’s less likely to cause side effects.
- Dose: Experts recommend sticking to 350 milligrams of magnesium supplements per day or less in order to avoid side effects. However, many brands sell magnesium supplements in dosages that are higher than this. Dosing can also depend on your pregnancy status, sex assigned at birth, and other medications or supplements you’re currently taking.
- Third-party testing: Look for companies that have their supplements undergo third-party testing. This testing can ensure that the supplements are not contaminated and their contents match what is listed on the label.
How to Decide if Magnesium Is Right for You
Any time you want to try a new supplement, it’s always a good idea to start by having a conversation with your primary care doctor. They may order bloodwork to see if you have a magnesium deficiency, and can answer any questions about concerns or potential side effects or interactions. This is especially important if you have other health conditions or take prescription medications .
In general, though, magnesium supplements are considered safe as long as you stay within the recommended dosage. If you’re having trouble sleeping or staying asleep, it could be a low-risk method to try. However, if you experience any side effects that persist beyond mild gastrointestinal issues, you should discontinue use and contact your doctor.
Does Magnesium Have Any Side Effects?
Consuming more than 350 milligrams worth of magnesium supplements in one day may cause side effects like diarrhea, nausea, and abdominal cramps . Certain forms of magnesium, like magnesium carbonate, magnesium chloride, magnesium gluconate, and magnesium oxide may be more likely to cause side effects .
How to Take Magnesium for Sleep
If you want to try magnesium for sleep problems, plan to give it a few weeks for effectiveness and make sure to take it at the same time everyday. Some experts recommend taking your supplement just before bedtime, especially if your primary goal is to improve sleep.
You can also incorporate other strategies to help fall asleep, such as a consistent bedtime routine, reducing caffeine and alcohol consumption, and shutting off screens at least 30 minutes before winding down. From there, look out for any side effects and track any noticeable improvements in sleep patterns to determine if magnesium is helping you.
Which Magnesium Is Best for Sleep?
If you want to take magnesium supplements for better sleep, consider choosing a form that is highly absorbable and less prone to side effects like gastrointestinal discomfort. Magnesium glycinate is a good option to try because it fits that criteria.
How Much Magnesium Should I Take for Sleep?
The amount of magnesium a person should consume each day depends on their age and existing health conditions. Generally, people should try not to take more than 350 milligrams of magnesium supplements per day in order to avoid side effects, according to the Food and Nutrition Board (FNB) at the Institute of Medicine of the National Academies.
Is It Safe to Take Magnesium Every Day?
Magnesium supplements are safe for most people to take daily, but taking more than 350 milligrams may cause side effects. Magnesium supplements can interact with some prescription drugs, so talk with a doctor before beginning magnesium.
Frequently Asked Questions
What’s the difference between magnesium and melatonin?
Magnesium and melatonin are very different, even though they may both play a role in sleep quality. Magnesium is an essential mineral people can consume through food, while melatonin is a hormone produced by the brain. Both are available in supplement form.
The brain creates melatonin in response to darkness, which sends a signal to your body that it’s time to fall sleep. For this reason, people sometimes take melatonin supplements when they want to change their sleep schedules, like if they work night shifts.
Magnesium levels may also impact sleep because of how it interacts with other chemicals in the brain, including melatonin.
Which magnesium is best for sleep and anxiety?
Magnesium supplements have been shown to help people who have anxiety and problems sleeping. While there have been no definitive studies regarding which form of magnesium is superior for this use case, there is a growing consensus that patients have better outcomes with forms that have high absorption rates like magnesium glycinate since those cause fewer gastrointestinal side effects.
What foods are high in magnesium?
Foods high in magnesium include seeds, leafy greens, nuts, beans, and rice. Roasted pumpkin seeds and chia seeds are the foods with the highest magnesium content. Nuts with the highest amount of magnesium include almonds, cashews, and peanuts. Some fish, like salmon and halibut, also contain magnesium.
How long does it take for magnesium to work for sleep?
When you take magnesium, your body will begin absorbing it within a few hours. However, there is no specific timeline as to when you might see improved sleep from magnesium supplementation, since study timelines vary. That said, experts generally say it may take a couple to several weeks to see sleep-related results. Make sure to take your supplement consistently at the same time each day. Over time, you may begin to notice some improvements.
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.
Still have questions? Ask our community!
Join our Sleep Care Community — a trusted hub of sleep health professionals, product specialists, and people just like you. Whether you need expert sleep advice for your insomnia or you’re searching for the perfect mattress, we’ve got you covered. Get personalized guidance from the experts who know sleep best.
References
15 Sources
-
Omofuma OO, Fang D, Yell N, Falomo O, Liu J, Steck SE. Trends in Reported Calcium and Magnesium Intake from Diet and Supplements by Demographic Factors: National Health and Nutrition Examination Survey, 2003-2018. J Acad Nutr Diet. 2024;124(10):1288-1301.e5. doi:10.1016/j.jand.2024.04.017
https://pmc.ncbi.nlm.nih.gov/articles/PMC12244524/ -
Breus M, Hooper S, Lynch T, Hausenblas H. Effectiveness of Magnesium Supplementation on Sleep Quality and Mood for Adults with Poor Sleep Quality: A Randomized Double-Blind Placebo-Controlled Crossover Pilot Trial. Medical Research Archives. 2024;12(7). doi:https://doi.org/10.18103/mra.v12i7.5410
https://esmed.org/MRA/mra/article/view/5410 -
National Institutes of Health. Magnesium. National Institutes of Health. Published 2022. https://ods.od.nih.gov/factsheets/Magnesium-HealthProfessional/
https://ods.od.nih.gov/factsheets/Magnesium-HealthProfessional/ -
Zhang, Y., Chen, C., Lu, L., Knutson, K. L., Carnethon, M. R., Fly, A. D., Luo, J., Haas, D. M., Shikany, J. M., & Kahe, K. (2022). Association of magnesium intake with sleep duration and sleep quality: findings from the CARDIA study. Sleep, 45(4), zsab276.
https://academic.oup.com/sleep/article/45/4/zsab276/6432454 -
Abbasi, B., Kimiagar, M., Sadeghniiat, K., Shirazi, M. M., Hedayati, M., & Rashidkhani, B. (2012). The effect of magnesium supplementation on primary insomnia in elderly: A double-blind placebo-controlled clinical trial. Journal of Research in Medical Sciences, 17(12), 1161–1169.
https://pubmed.ncbi.nlm.nih.gov/23853635/ -
Papadopol V, Nechifor M. Magnesium in neuroses and neuroticism. PubMed. Published 2011. https://www.ncbi.nlm.nih.gov/books/NBK507254/
https://www.ncbi.nlm.nih.gov/books/NBK507254/ -
Alizadeh M, Karandish M, Asghari Jafarabadi M, et al. Metabolic and hormonal effects of melatonin and/or magnesium supplementation in women with polycystic ovary syndrome: a randomized, double-blind, placebo-controlled trial. Nutr Metab (Lond). 2021;18(1):57. Published 2021 Jun 6. doi:10.1186/s12986-021-00586-9
https://pubmed.ncbi.nlm.nih.gov/34092248/ -
Zain AlShanableh, Ray EC. Magnesium in hypertension: mechanisms and clinical implications. Frontiers in physiology. 2024;15. doi:https://doi.org/10.3389/fphys.2024.1363975
https://www.frontiersin.org/journals/physiology/articles/10.3389/fphys.2024.1363975/full -
Boyle, N. B., Lawton, C., & Dye, L. (2017). The effects of magnesium supplementation on subjective anxiety and stress – A systematic review. Nutrients, 9(5), 429.
https://pubmed.ncbi.nlm.nih.gov/28445426/ -
Marshall, N. S., Serinel, Y., Killick, R., Child, J. M., Raisin, I., Berry, C. M., Lallukka, T., Wassing, R., Lee, R. W., Ratnavadivel, R., Vedam, H., Grunstein, R., Wong, K. K., Hoyos, C. M., Cayanan, E. A., Comas, M., Chapman, J. L., & Yee, B. J. (2019). Magnesium supplementation for the treatment of restless legs syndrome and periodic limb movement disorder: A systematic review. Sleep Medicine Reviews, 48, 101218.
https://pubmed.ncbi.nlm.nih.gov/31678660/ -
Winkelman, J. W. (2022, May 6). Nocturnal leg cramps. In I. N. Targoff & J. M. Shefner (Eds.). UpToDate.
https://www.uptodate.com/contents/nocturnal-leg-cramps -
Jadidi, A., Rezaei Ashtiani, A., Khanmohamadi Hezaveh, A., & Aghaepour, S. M. (2022). Therapeutic effects of magnesium and vitamin B6 in alleviating the symptoms of restless legs syndrome: a randomized controlled clinical trial. BMC complementary medicine and therapies, 23(1), 1.
https://pubmed.ncbi.nlm.nih.gov/36587225 -
Boyle NB, Lawton C, Dye L. The Effects of Magnesium Supplementation on Subjective Anxiety and Stress—A Systematic Review. Nutrients. 2017; 9(5):429. https://doi.org/10.3390/nu9050429
https://www.mdpi.com/2072-6643/9/5/429 -
Rawji A, Peltier MR, Mourtzanakis K, et al. Examining the Effects of Supplemental Magnesium on Self-Reported Anxiety and Sleep Quality: A Systematic Review. Cureus. 2024;16(4):e59317. Published 2024 Apr 29. doi:10.7759/cureus.59317
https://pmc.ncbi.nlm.nih.gov/articles/PMC11136869/