Everything You Need To Know About Magnesium And Sleep

Table of Contents
foods with magnesium

Magnesium has a dedicated fanbase for things like alleviating restless legs, relaxing muscle cramps, and boosting digestive regularity — but did you know it can also benefit your sleep? Many of us adults aren’t getting the recommended 7-9 hours of quality sleep each night. (1) And whether you’re looking for a better mattress, a sleep coach, or a natural sleep aid like magnesium, it’s no secret there’s been an uptick in the business of helping people sleep. Here’s how magnesium can work to help you catch more Z’s. 

Note: The content on Sleepopolis is meant to be informative in nature, but it shouldn’t be taken as medical advice, and it shouldn’t take the place of medical advice and supervision from a trained professional. If you feel you may be suffering from any sleep disorder or medical condition, please see your healthcare provider immediately.

What Is Magnesium? 

Magnesium is an essential mineral that plays a pivotal role in your health and wellness, and it has a meaningful impact on the following: (2) (3)

  • Energy production
  • Nervous system regulation
  • Bone health
  • Heart health
  • Blood pressure regulation
  • Blood sugar control
  • Anti-inflammatory effects
  • Stress management
  • Restfulness and sleep
  • Muscle contraction and relaxation

How Does Magnesium Affect Sleep? 

Magnesium plays a significant role in the sleep cycle through the way it interacts with various physiological and neurological processes. There’s some evidence that not having enough magnesium in your body may negatively impact your sleep. For example, some animal studies have found an association between magnesium deficiency and low circulating levels of melatonin. (3)

Here are five ways magnesium contributes to the promotion of healthy sleep: 

  1. GABA regulation: Magnesium enhances the activity of gamma-aminobutyric acid (GABA), a neurotransmitter with calming effects on the central nervous system. GABA’s role is to inhibit nerve transmission, promote relaxation, and reduce neural excitability, which are key elements in the process of falling asleep. (4)(5)
  2. Muscle relaxation: Magnesium acts as a natural muscle relaxant, easing tension and promoting a sense of calmness. (5)
  3. Melatonin production: Magnesium is involved in the production of melatonin, often referred to as the “sleep hormone.” Magnesium’s influence on melatonin production helps establish and maintain the body’s natural circadian rhythm. (6)
  4. Nervous system calming: Magnesium helps regulate the function of the autonomic nervous system, which controls the sleep-wake cycle. By calming the nervous system, magnesium contributes to a state of relaxation that supports the transition from wakefulness to sleep. (4)
  5. Stress reduction: Most of us aren’t strangers to a sleepless night caused by stress —  magnesium can come in handy around bedtime thanks to its stress-relieving properties. By regulating the stress response and reducing the production of stress hormones, magnesium can help alleviate factors that contribute to insomnia and sleep disturbances. (5)

How to Take Magnesium

There are plenty of magnesium supplements to choose from. Limited research suggests that aspartate, citrate, lactate, and chloride forms of magnesium are better absorbed compared to magnesium oxide and magnesium sulfate. (2) (7

Additionally, according to registered dietitian Amy Archer, “Magnesium threonate crosses the blood-brain barrier, showing benefits for learning, memory, and cognition. This is an exciting area of new research.” (8)

The blood-brain barrier is a protective barrier formed by special cells that limit what substances can enter the brain from your bloodstream. While more research is needed, the ability of magnesium threonate to cross this barrier means it can have a more direct effect on your brain health compared to other forms of magnesium.

If you’re looking to add magnesium to your routine, consider consulting with a healthcare professional to determine the most suitable form and dosage based on your individual needs. It’s often recommended to take magnesium supplements in the evening, as this aligns with the body’s natural circadian rhythm and may enhance the mineral’s calming effects. 

However, as with most things, more magnesium is not always better. The overall risk of magnesium overdose is low for most people, but adding a megadose supplement can be problematic. Avoid taking excessive doses of magnesium as very high levels can be toxic and adversely affect the nervous, respiratory, and cardiovascular systems, even leading to cardiac arrest. (9)

How Much Magnesium Should I Take For Sleep? 

Whenever possible, experts recommend trying to obtain magnesium from foods, like leafy green vegetables, nuts, seeds, whole grains, and legumes — more on that below! A supplement can be considered if you don’t consume many magnesium-rich foods. 

The recommended dosage of magnesium for sleep can vary based on individual factors such as age, sex, and health status. The Recommended Dietary Allowance (RDA) for magnesium ranges from 310 to 420 milligrams per day for adults. An appropriate dosage for most people will likely align with this, though your needs may be different if you have a diagnosed magnesium deficiency. (2

It’s also important to understand that responses to magnesium supplementation can vary — it may be a great addition to your bedtime routine, but not so much for your spouse, for example. Some people may experience positive effects at lower doses, while others may require higher amounts. Pay attention to your body’s response and adjust accordingly.

Before making significant changes to your magnesium intake or starting any new supplement, consult with a healthcare provider. They can assess your specific needs and potential interactions with medications, and help determine a safe and effective dosage for supporting better sleep. 

Magnesium and Anxiety 

Magnesium may also contain anti-anxiety properties. (10) Experiencing less anxiety makes it easier for most of us to fall asleep, and sleep helps reduce stress. Specifically, the way magnesium acts on GABA promotes calming effects, says Archer. (3

Here’s what some of the most current research says about magnesium’s effects on anxiety:

  • In a 2022 controlled clinical trial, 60 candidates for open-heart surgery were divided into control and intervention groups. The intervention group received 250 mg of magnesium oxide tablets twice daily for five days following surgery, and the control group received routine care without magnesium supplementation. The authors found that those who received magnesium experienced a significantly lower level of anxiety and depression compared to the control group at the end of the study, suggesting it be a regular part of the treatment plan for this type of procedure. (11)
  • A 2020 systematic review of 32 articles found that magnesium supplementation could increase circulating levels of the mineral and have a positive effect on certain mental health conditions, including depression and stress. However, results were mixed and more research is needed. (12)
  • Some recent research has found that magnesium can be even more effective for reducing anxiety when it’s combined with other compounds and nutrients, such as B vitamins, L-theanine, and Rhodiola. (13) (14)

How Can I Raise My Magnesium Levels Naturally? 

According to sports performance and wellness dietitian Umo Callins, it’s ideal to try to increase your intake of magnesium through your diet first before supplementing it. “I recommend increasing magnesium-rich foods such as legumes, nuts, seeds, avocado, whole grains, leafy greens, and some fatty fish such as salmon or halibut,” she says. 

Foods High in Magnesium

Some of the most beneficial dietary sources of magnesium are listed below. While magnesium content may be influenced by things like cooking methods and specific varieties of food, we’ve listed approximately how much magnesium you can expect to find per serving. 

  • Spinach: 160 mg per 1 cup cooked (15)
  • Almonds: 100 mg per ¼ cup (16)
  • Cashews: 85 mg per 1 ounce (17)
  • Pumpkin seeds: 65 mg per ¼ cup (18)
  • Dark chocolate: 65 mg per 1 ounce of 70-85% cocoa (19)
  • Avocado: 60 mg per 1 medium-sized fruit (20)
  • Bananas: 30 mg per 1 medium-sized fruit (21)
  • Whole wheat bread: 50 mg per two slices (22)
  • Brown rice: 60 mg per 1 cup cooked (23)
  • Salmon: 25 mg per 3 ounces cooked (24)

Is Magnesium Better Than Melatonin? 

Magnesium is one of many supplemental sleep aids people are turning to for improving their ability to rest. Another popular option is melatonin. But how do the two compare

Well, it ultimately depends on your personal preference. Callins says, “Studies show that both magnesium and melatonin can help with improving sleep quality. However, there is more conclusive research on melatonin supplementation and its link to improved sleep quality.” She recommends trying them both and seeing whether one has a more positive benefit for you than the other. (6) (25)

Want a more creative way to boost your magnesium intake? Consider trying the viral Sleepy Girl Mocktail. Made popular in early 2023, this tasty drink is intended to help promote a sense of calm as you prepare for sleep. 

It’s easy to make, too — all you need is tart cherry juice, magnesium powder, and Lemon Lime OLIPOP prebiotic soda (or something similar) for flavor. While research is mixed, there is some evidence that tart cherry juice is high in melatonin, which can help support sleep. (26)


How long does it take magnesium to work for sleep?

The effects of magnesium can differ for everyone. If you’re taking it for sleep, how quickly (and how much) it works can depend on the form, how consistently you’re using it, and the dosage. Furthermore, if there’s a more serious underlying cause for your sleep challenges, magnesium may not help as much as you hope.

When to take magnesium for sleep?

Though everyone’s body may react a little differently, many people find it helpful to take magnesium closer to bedtime as part of their nightly routine. Taking it later in the day can be more aligned with your body’s natural circadian rhythm.

Can magnesium keep you awake?

Magnesium isn’t known to act as a stimulant, but rather to have a calming effect. Still, people can have varying responses to any supplement. For example, taking high doses of magnesium could trigger digestive upset in some people, which could make it harder to fall asleep.

The Last Word From Sleepopolis 

Magnesium is an essential mineral involved in many processes that help keep you healthy. It’s also known to have a calming effect, which is why many people find it helpful for inducing relaxation in preparation for sleep. Not getting enough magnesium may be associated with difficulty sleeping. 

You can increase it by eating more magnesium-rich foods, like leafy greens, dark chocolate, avocados, nuts, and legumes, and consider adding a modest magnesium supplement if needed. Always speak with your healthcare provider before adding a new supplement to your routine, especially if you’re concerned about your sleep, as there may be potential interactions or other underlying factors to consider.



  1. Ramar K, Malhotra RK, Carden KA, et al. Sleep is essential to health: an American Academy of Sleep Medicine position statement. J Clin Sleep Med. 2021;17(10):2115-2119. doi:10.5664/jcsm.9476
  2. Magnesium Fact Sheet for Consumers. Updated 2 June 2022. Available: https://ods.od.nih.gov/factsheets/magnesium-healthprofessional/
  3. Zhang Y, Chen C, Lu L, et al. Association of magnesium intake with sleep duration and sleep quality: findings from the CARDIA study. Sleep. 2022;45(4):zsab276. doi:10.1093/sleep/zsab276
  4. Xue W, You J, Su Y, Wang Q. The Effect of Magnesium Deficiency on Neurological Disorders: A Narrative Review Article. Iran J Public Health. 2019;48(3):379-387.
  5. Pickering G, Mazur A, Trousselard M, et al. Magnesium Status and Stress: The Vicious Circle Concept Revisited. Nutrients. 2020;12(12):3672. Published 2020 Nov 28. doi:10.3390/nu12123672
  6. Mah J, Pitre T. Oral magnesium supplementation for insomnia in older adults: a Systematic Review & Meta-Analysis. BMC Complement Med Ther. 2021;21(1):125. Published 2021 Apr 17. doi:10.1186/s12906-021-03297-z
  7. Uysal N, Kizildag S, Yuce Z, et al. Timeline (Bioavailability) of Magnesium Compounds in Hours: Which Magnesium Compound Works Best?. Biol Trace Elem Res. 2019;187(1):128-136. doi:10.1007/s12011-018-1351-9
  8. Zhang C, Hu Q, Li S, et al. A Magtein®, Magnesium L-Threonate, -Based Formula Improves Brain Cognitive Functions in Healthy Chinese Adults. Nutrients. 2022;14(24):5235. Published 2022 Dec 8. doi:10.3390/nu14245235
  9. Ajib FA, Childress JM. Magnesium Toxicity. [Updated 2022 Nov 7]. In: StatPearls [Internet]. Treasure Island (FL): StatPearls Publishing; 2023 Jan-. Available from: https://www.ncbi.nlm.nih.gov/books/NBK554593/
  10. Aucoin M, LaChance L, Naidoo U, et al. Diet and Anxiety: A Scoping Review. Nutrients. 2021;13(12):4418. Published 2021 Dec 10. doi:10.3390/nu13124418
  11. Saba S, Faizi F, Sepandi M, Nehrir B. Effect of short-term magnesium supplementation on anxiety, depression and sleep quality in patients after open-heart surgery. Effect of short-term magnesium supplementation on anxiety, depression and sleep quality in patients after open-heart surgery. Magnes Res. 2022;35(2):62-70. doi:10.1684/mrh.2022.0503
  12. Botturi A, Ciappolino V, Delvecchio G, Boscutti A, Viscardi B, Brambilla P. The Role and the Effect of Magnesium in Mental Disorders: A Systematic Review. Nutrients. 2020;12(6):1661. Published 2020 Jun 3. doi:10.3390/nu12061661
  13. Noah L, Dye L, Bois De Fer B, Mazur A, Pickering G, Pouteau E. Effect of magnesium and vitamin B6 supplementation on mental health and quality of life in stressed healthy adults: Post-hoc analysis of a randomised controlled trial. Stress Health. 2021;37(5):1000-1009. doi:10.1002/smi.3051
  14. Noah L, Morel V, Bertin C, et al. Effect of a Combination of Magnesium, B Vitamins, Rhodiola, and Green Tea (L-Theanine) on Chronically Stressed Healthy Individuals-A Randomized, Placebo-Controlled Study. Nutrients. 2022;14(9):1863. Published 2022 Apr 29. doi:10.3390/nu14091863
  15. Spinach, cooked, boiled, drained, without salt. FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/168463/nutrients 
  16. Nuts, almonds. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/170567/nutrients 
  17. Nuts, cashew nuts, raw. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/170162/nutrients 
  18. Pumpkin seeds, unsalted. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/2343056/nutrients
  19. Chocolate, dark, 70-85% cacao solids. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/170273/nutrients 
  20. Avocados, raw, all commercial varieties. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/171705/nutrients 
  21. Bananas, raw. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/173944/nutrients 
  22. Bread, whole-wheat, commercially prepared. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/172688/nutrients 
  23. Rice, brown, parboiled, cooked. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/173263/nutrients
  24. Fish, salmon, pink, cooked, dry heat. USDA FoodData Central. Available: https://fdc.nal.usda.gov/fdc-app.html#/food-details/172001/nutrients 
  25. Fatemeh G, Sajjad M, Niloufar R, Neda S, Leila S, Khadijeh M. Effect of melatonin supplementation on sleep quality: a systematic review and meta-analysis of randomized controlled trials. J Neurol. 2022;269(1):205-216. doi:10.1007/s00415-020-10381-w
  26. Kelley DS, Adkins Y, Laugero KD. A Review of the Health Benefits of Cherries. Nutrients. 2018;10(3):368. Published 2018 Mar 17. doi:10.3390/nu10030368
Lauren Panoff

Lauren Panoff

Lauren Panoff, MPH, RD is a Colorado-based health and nutrition writer who has been published with a number of trusted wellness platforms. She is a dietitian who specializes in plant-based living, as well as a mother of two humans and a dog.