Can Taking Magnesium and Melatonin Together Help You Sleep Better?

Image By nuraghies

Fast Facts

  • Melatonin supplements are a common solution for people who may struggle with insomnia.

  • Taking magnesium supplements may help melatonin work more effectively.

  • Experts recommend consulting a healthcare professional before adding either melatonin or magnesium into your supplement routine.

Is the combination of melatonin and magnesium the secret to sleep success?

Millions of Americans have insomnia, a disorder that makes it difficult to fall or stay asleep.1 The condition affects almost 30% of adults—data shows that nearly 15% of adults in the U.S. have trouble falling asleep most nights.23

The use of melatonin supplements to help ease symptoms of insomnia has grown increasingly popular.4 Melatonin is a hormone produced by the brain in response to darkness that helps regulate your internal clock.5

But taking a melatonin supplement isn’t the only way to get quality sleep: Getting enough physical activity, limiting alcohol consumption, and limiting screen time are all ways to help your body get enough rest.6

Consuming enough magnesium might also help, though there’s no research to support the idea that magnesium helps to induce sleep.

“The evidence is still not there that it promotes sleep,” Katrina Hartog, DCN, MPH, RDN, CHES, CLC, director of clinical nutrition at Mount Sinai West, told Health.

That said, magnesium levels could be indirectly related to our body’s ability to stay on a sleep schedule—this may be why some over-the-counter sleep products contain both melatonin and magnesium.

Here’s what you need to know about the effects of magnesium and melatonin on sleep, and what to consider before starting new supplements.

Why Your Body Needs Magnesium

Magnesium plays many important roles in keeping your body healthy.

“It’s used for more than 300 biochemical reactions in our body,” Hartog said.

The mineral helps regulate nerve and muscle function, blood pressure, and blood sugar levels, and it’s also involved in the production of bone, protein, and DNA.7

Magnesium can be found in the following foods:7

  • Legumes
  • Nuts
  • Seeds
  • Green leafy vegetables (such as spinach)
  • Whole grains
  • Milk
  • Yogurt
  • Fortified foods (such as breakfast cereals)

Adult women should get 310 to 320 milligrams of magnesium each day (though pregnant women require more), and adult men should get 400 to 420 milligrams.7

For reference: one ounce of dry, roasted almonds contains 80 milligrams of magnesium, half a cup of boiled spinach contains 78 milligrams, and one cup of soy milk contains 61 milligrams.7

People who don’t get enough magnesium from their diet may be deficient, and they may benefit from a magnesium supplement.

Supplements may be especially beneficial for older people because their bodies may not efficiently absorb magnesium, Marie van der Merwe, PhD, coordinator of the applied physiology and nutrition doctoral program at the University of Memphis, told Health.

In addition to boosting magnesium levels, supplements may cause a slight reduction in diastolic blood pressure. They may also be helpful for people at risk of osteoporosis, since the supplements may increase bone mineral density.7

Why Your Body Needs Melatonin

Melatonin is a hormone that helps your body know when to go to sleep and wake up each day.

“Melatonin is in charge of running the [internal] clock, and it really is important for regulating your circadian rhythms,” van der Merwe said.

Your body makes melatonin when you’re exposed to darkness, but light exposure in the evening can block melatonin production.5

This is why it’s important to monitor how much time you’re spending on your phone in the hours before bedtime, van der Merwe explained.

Melatonin may contribute to other bodily functions, but experts don’t know what else melatonin may influence outside of sleep.5

Though melatonin can help some people who are having a hard time getting their sleep schedule on track, it can’t fix all sleep disorders, van der Merwe explained, since a host of health issues can affect sleep.

“If your schedule is off, melatonin might help, but if [your sleep issues] are caused by something else, maybe not,” she said.

In addition to supplements, melatonin can be found in the following foods:8

  • Eggs
  • Fish
  • Nuts
  • Some mushrooms
  • Some grains
  • Seeds

Magnesium May Impact Sleep Because of Its Effect on Melatonin

Research on how magnesium and melatonin affect one another is limited.

“The whole mechanism of how magnesium affects sleep is not well-understood,” van der Merwe explained.

But magnesium may indirectly affect sleep through its effects on melatonin.

“Magnesium does have an effect on melatonin levels,” she explained. “The amount of magnesium you have can affect how well you synthesize melatonin.”

This could be why the two are packaged together in many products. That said, you don’t have to take magnesium at the same time as melatonin to reap a possible benefit.

“If I take my magnesium supplement in the morning, it’s not like I have it for the next 30 minutes then it’s gone,” van der Merwe said, adding that your magnesium levels will be higher for hours after taking the supplement.

Ultimately, experts say there could be a connection between magnesium levels and sleep, but more research is needed for any clinical confirmation.

What to Consider Before Taking New Supplements

It’s best to speak with a healthcare provider, such as a primary care physician, before trying any new supplements, including magnesium and melatonin.

“There are medications that could interact with a magnesium supplement, [such as] some medications that treat osteoporosis and some antibiotics,” Hartog said.

These interactions are more common with magnesium supplements than melatonin supplements, but it’s still worth checking with your doctor before adding either into your routine.

Van der Merwe noted that sleep issues may be caused by something melatonin won’t fix. Difficulty sleeping has been linked to cardiovascular disease, type 2 diabetes, depression, and other health conditions.9

So, it’s important to speak with a doctor to determine whether any underlying illness—or other medications you’re taking—is affecting your sleep issues.

Your doctor can also help you assess the best time of day to take a magnesium supplement, a melatonin supplement, or one that combines both.

“Melatonin [should] get increased at nighttime,” van der Merwe explained, so you need to take the supplement “at a very specific time during the day. If you take melatonin in the morning, you screw up the whole [internal] clock.”

Though melatonin has become popular in recent years, it’s ultimately worth checking with someone before you take it to establish whether it may help you.

“It’s important for people to realize it’s not a sleeping pill,” van der Merwe said. “You’re affecting the intrinsic machinery of your body—you’re slowly tuning it to function optimally—so it really is important for people to reflect on what might be the issue.”


  1. National Heart, Lung, and Blood Institute. What is insomnia?.
  2. Olfson M, Wall M, Liu SM, Morin CM, Blanco C. Insomnia and impaired quality of life in the United States. J Clin Psychiatry. 2018;79(5):17m12020. doi:10.4088/JCP.17m12020
  3. Adjaye-Gbewonyo D, Ng AE, Black LI. Sleep difficulties in adults: United States, 2020. NCHS Data Brief. 2022;(436).
  4. National Institutes of Health. Use of melatonin supplements rising among adults.
  5. National Center for Complementary and Integrative Health. Melatonin: what you need to know.
  6. NIH News in Health. Good sleep for good health: get the rest you need.
  7. National Institutes of Health Office of Dietary Supplements. Magnesium: fact sheet for health professionals.
  8. Meng X, Li Y, Li S, et al. Dietary sources and bioactivities of melatonin. Nutrients. 2017;9(4):367. doi:10.3390/nu9040367
  9. Centers for Disease Control and Prevention. Sleep and chronic disease.

Important Notice: This article was originally published at by Maggie O’Neill where all credits are due.  Fact checked by Nick Blackmer


The watching, interacting, and participation of any kind with anything on this page does not constitute or initiate a doctor-patient relationship with Dr. Farrah™. None of the statements here have been evaluated by the Food and Drug Administration (FDA). The products of Dr. Farrah™ are not intended to diagnose, treat, cure, or prevent any disease. The information being provided should only be considered for education and entertainment purposes only. If you feel that anything you see or hear may be of value to you on this page or on any other medium of any kind associated with, showing, or quoting anything relating to Dr. Farrah™ in any way at any time, you are encouraged to and agree to consult with a licensed healthcare professional in your area to discuss it. If you feel that you’re having a healthcare emergency, seek medical attention immediately. The views expressed here are simply either the views and opinions of Dr. Farrah™ or others appearing and are protected under the first amendment.

Dr. Farrah™ is a highly experienced Licensed Medical Doctor certified in evidence-based clinical nutrition, not some enthusiast, formulator, or medium promoting the wild and unrestrained use of nutrition products for health issues without clinical experience and scientific evidence of therapeutic benefit. Dr. Farrah™ has personally and keenly studied everything she recommends, and more importantly, she’s closely observed the reactions and results in a clinical setting countless times over the course of her career involving the treatment of over 150,000 patients.

Dr. Farrah™ promotes evidence-based natural approaches to health, which means integrating her individual scientific and clinical expertise with the best available external clinical evidence from systematic research. By individual clinical expertise, I refer to the proficiency and judgment that individual clinicians acquire through clinical experience and clinical practice.

Dr. Farrah™ does not make any representation or warranties with respect to the accuracy, applicability, fitness, or completeness of any multimedia content provided. Dr. Farrah™ does not warrant the performance, effectiveness, or applicability of any sites listed, linked, or referenced to, in, or by any multimedia content.

To be clear, the multimedia content is not intended to be a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health providers with any questions you may have regarding a medical condition. Never disregard professional medical advice or delay in seeking it because of something you have read or seen in any website, video, image, or media of any kind. Dr. Farrah™ hereby disclaims any and all liability to any party for any direct, indirect, implied, punitive, special, incidental, or other consequential damages arising directly or indirectly from any use of the content, which is provided as is, and without warranties.