Key takeaways:
Studies suggest that magnesium may help you fall asleep faster, stay asleep longer, and wake up less overnight.
There aren’t enough high-quality studies for magnesium to be recommended as a routine sleep aid. But for most people taking magnesium is low risk and doesn’t usually cause side effects.
If you take magnesium for sleep, don’t forget to also focus on other ways to help you sleep better, too — like limiting caffeine, keeping the bedroom cool, and having a regular bedtime.
Magnesium helps with many daily body processes. And sleep is one that gets a lot of attention. If you follow social media trends, you might be wondering if it’s the answer to all your sleep troubles. But what does the research say? We’ll take a deep dive into the science of magnesium and sleep to help you decide if magnesium is worth a try.
Magnesium is a nutrient our bodies need for:
Healthy muscles and nerves
Regulating blood pressure and blood sugar
Building strong bones, essential proteins, and DNA
The daily recommended amount of magnesium for adults ranges from 310 mg to 420 mg. The good news is following a healthy diet that focuses on various nutrient-dense foods can help you get enough magnesium.
Common food sources of magnesium include:
Seeds and nuts: such as pumpkin seeds, almonds, and cashews
Grains: such as oatmeal, fortified cereals, and whole wheat bread
Beans and legumes: such as black beans, kidney beans, and edamame
Dairy: such as milk and plain yogurt
Fruit and vegetables: such as bananas, raisins, and avocado
Proteins: such as salmon, chicken breast, and beef
A healthcare professional may recommend a magnesium supplement in some cases, like to treat a magnesium deficiency. Most people don’t need a supplement to keep their magnesium level in a normal range. Still, some people take a supplement for one of its many reported benefits.
In the past few years, magnesium has become a popular topic on social media as a possible sleep aid. Magnesium was even the star ingredient in a “sleepy girl mocktail” that went viral on TikTok. The claim is that magnesium can be added to tart cherry juice and seltzer to help people sleep.
The research on magnesium and sleep has been mixed. But the majority of studies show some benefit to taking magnesium. A review of eight studies found that people taking magnesium were more likely to report:
Better sleep quality overall
Less time to fall asleep
Fewer times waking up overnight
Strategies for better sleep: Your environment and lifestyle can affect your sleep more than you might think. Read about ways to help boost your sleep quality.
Magnesium and drug interactions: If you’re thinking of starting magnesium, make sure to review these common drug interactions, like antibiotics and calcium.
Medications for sleep: Learn about common prescription medications for treating insomnia, along with potential risks.
Those studies measured people’s perception about their sleep. But does that mean their sleep quality was actually better?
In a 2024 study, researchers tried to measure this by having participants wear a medical device while sleeping. Participants took either magnesium or a placebo daily for 2 weeks, then switched to the other option for another 2 weeks. Researchers found that taking magnesium:
Increased deep sleep
Increased overall amount of sleep
Reduced the number of times people woke up overnight
Another similar study from 2024 found that magnesium not only helps sleep quality, but also improves daytime energy, daytime productivity, and alertness.
But the evidence isn’t settled yet. “The science on the use of magnesium to promote sleep quality and sleep duration has been mixed,” says Indira Gurubhagavatula, MD, MPH, associate professor at the University of Pennsylvania’s Perelman School of Medicine. These mixed results might have been because of differences in dosing, timing, or presence of chronic health conditions. Other studies that found benefits to taking magnesium to improve sleep are considered poor quality. More high-quality research is needed to know how and when to treat sleep problems with magnesium.
Magnesium plays an important role in helping your nerves and muscle function. Magnesium may help you sleep by:
Relaxing your nervous system: It activates GABA receptors, which calm your nervous system and make it easier to wind down in the evening.
Relaxing your muscles: Magnesium helps muscles relax so that you feel less tension as you’re trying to sleep.
Regulating melatonin: Magnesium plays a role in making melatonin. Melatonin is a hormone that helps regulate your sleep-wake cycle.
Lowering your cortisol: Studies have shown that taking magnesium can lower your stress hormone, cortisol.
“Overall, magnesium is not something that is routinely prescribed by sleep doctors. Not because of side effects — though too much magnesium could certainly cause these. But rather because results aren't clear,” says Kenneth Lee, MD, Medical Director of the University of Chicago Sleep Center. This may change now that newer studies are suggesting magnesium may indeed help you sleep.
The American Academy of Sleep Medicine published guidelines on medications and supplements for sleep in 2017, and magnesium wasn’t discussed at all. But, in 2024, the European Society of Sleep Medicine published this statement: “Magnesium supplementation may be an effective nonpharmacological intervention to promote sleep and mood.”
Experts also emphasize the importance of finding out what’s causing insomnia. A sleep disorder — like sleep apnea, restless legs, or even narcolepsy — could be at play. Or, it could be due to lifestyle factors, such as nicotine, caffeine, or alcohol. Sleep problems could also be a symptom of a medical condition such as chronic pain, dementia, or depression.
“A full medical evaluation can help identify the root cause,” says Gurubhagavatula. “This is important, so people don’t miss potentially serious conditions, and get the appropriate treatment,”
If you’re going to take a magnesium supplement, The Food and Nutrition Board (FNB) recommends taking 350 mg or less. It’s hard to know exactly how much magnesium you should take to help you sleep, since there aren’t official guidelines for magnesium and sleep. But studies in which magnesium was effective often used doses of at least 250 mg per day.
If you’re taking the recommended dosing of magnesium, you’re unlikely to have side effects. That’s because your kidneys can get rid of a little extra magnesium in the urine. But taking high doses of magnesium, above the recommended amount, can cause diarrhea, stomach pain, and cramping. And anyone with a history of kidney problems should check with their healthcare team before taking a magnesium supplement.
Very large doses of magnesium from laxatives and antacids — which could contain more than 5,000 mg in a day — can cause serious symptoms of magnesium toxicity. These symptoms include:
Low blood pressure
Sleepiness
Vomiting
Muscle weakness
It’s worth a try. Since magnesium has low risk for side effects, it’s safe to try out as a sleep remedy. To be sure you’re buying a safe and effective supplement, look for a third-party certification seal.
And, remember, it’s still important to focus on healthy sleep habits. Even small changes — like avoiding electronics before bedtime or picking the right mattress — can make a big difference when it comes to sleep. Gurubhagavatula recommends:
Limiting caffeine and alcohol
Keeping a regular bedtime and wake-up time
Sleeping in a dark, cool, and quiet environment
There’s no clear consensus on the exact timing of taking magnesium supplements. But, if you’re taking magnesium to help you sleep, you might find it more helpful to take in the evening. Taking it about an hour before bedtime should be enough time for its effects on your brain and muscles to kick in.
There are many different types of magnesium supplements. But it’s not clear which type works best for sleep. Studies on magnesium and sleep used different formulations, such as:
Magnesium glycinate
Magnesium L-aspartate
Magnesium oxide
Magnesium lactate
Magnesium has been shown in some studies to help with anxiety. The results aren’t consistent, though. It seems to be more helpful for people with mild-to-moderate anxiety than severe anxiety. And a large review found that magnesium wasn’t helpful for people who were experiencing anxiety recently after having had a baby.
If you struggle with sleep, you might feel desperate for solutions. Magnesium is a popular option that may help. There’s evidence that it can help people fall asleep faster, stay asleep longer, and wake up less at night. It may not be quite the miracle cure that’s gone viral on social media, but it’s low risk and worth a try. For the best chance of success, make sure to focus on health sleep habits as well — like avoiding screens before bedtime, limiting caffeine and alcohol, and keeping your bedroom cool.
Andersen, S., et al. (2021). Does magnesium supplementation decrease anxiety in adults? Evidence-Based Practice.
Arab, A., et al. (2023). The role of magnesium in sleep health: A systematic review of available literature. Biological Trace Element Research.
Boyle, N. B., et al. (2017). The effects of magnesium supplementation on subjective anxiety and stress—A systematic review. Nutrients.
Breus, M. J., et al. (2024). Effectiveness of magnesium supplementation on sleep quality and mood for adults with poor sleep quality: A randomized double-blind placebo-controlled crossover pilot trial. European Society of Medicine.
Godoy, M., et al. (2024). Magnesium is social media's new favorite magic aid for sleep. Here's what science says. NPR.
Hausenblas, H. A., et al. (2024). Magnesium-L-threonate improves sleep quality and daytime functioning in adults with self-reported sleep problems: A randomized controlled trial. Sleep Medicine: X.
Mah, J., et al. (2021). Oral magnesium supplementation for insomnia in older adults: A systematic review and meta-analysis. BioMed Central Complementary Medicine and Therapies.
National Institutes of Health. (2021). Magnesium.
Rawji, A., et al. (2024). Examining the effects of supplemental magnesium on self-reported anxiety and sleep quality: A systematic review. Cureus.
Zhang, Y., et al. (2021). Association of magnesium intake with sleep duration and sleep quality: Findings from the CARDIA study. Sleep.