• 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. The condition affects almost 30% of adults—data shows that nearly 15% of adults in the U.S. have trouble falling asleep most nights.


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


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.


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.


Woman taking pills before bed

Liudmila Chernetska / Getty Images


Before You Buy Magnesium Supplements From TikTok, Here’s What You Need to Know

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.


Magnesium can be found in the following foods:


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.


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.


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.


Can You Take Melatonin Every Night?

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.


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.


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:


  • Eggs
  • Fish
  • Nuts
  • Some mushrooms
  • Some grains
  • Seeds
How Does Magnesium Help Reduce Anxiety?

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.


Which Minerals and Vitamins Should You Take?

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.


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.”