Melatonin vs Magnesium for Sleep: What Studies Show
[Sleep · Comparison]

Melatonin vs magnesium: which has better sleep evidence?

Meta-analyses · Effect size · Safety · Interactions

Short answer: Melatonin has more trials behind it: in a meta-analysis of 19 trials, people fell asleep about 7 minutes sooner and slept about 8 minutes longer than on placebo.1 Magnesium's sleep evidence is thinner and inconsistent, rated low to very low certainty.2 NIH says there is not enough strong evidence on melatonin for chronic insomnia.3 No trial has tested one against the other as a sleep treatment.

How do melatonin and magnesium compare for sleep?

From NIH pages and the reviews cited. The numbers come from separate reviews, not a trial of one against the other.
MelatoninMagnesium
What it isA hormone the brain makes in response to darkness; supplements are mostly synthetic3A mineral found in food and supplements4
Size of the evidence19 placebo-controlled trials, 1,683 people with primary sleep disorders112 trials in a 2026 review; 3 trials in 151 older adults in a 2021 meta-analysis25
Time to fall asleep vs placeboAbout 7 minutes shorter1About 17 minutes shorter in older adults, from 3 small trials5
Total sleep vs placeboAbout 8 minutes longer116 minutes longer, not statistically significant5
Quality of evidenceEffects described as modest by the review authors1Low to very low certainty; findings inconsistent2
Where it may help mostJet lag, delayed sleep-wake phase disorder, anxiety before surgery3Not established; the 2026 review says it is not supported as a routine insomnia treatment2
Side effectsMild in short-term studies: headache, dizziness, nausea, sleepiness3High supplement doses can cause diarrhea, nausea and abdominal cramping4

Reviewed . Half-life figures are shown only where the value Dose Track uses agrees with the cited source.

What does the melatonin research show?

A 2013 meta-analysis of 19 placebo-controlled trials in 1,683 adults and children with primary sleep disorders found melatonin shortened the time to fall asleep by about 7 minutes and added about 8 minutes of total sleep, with a small improvement in overall sleep quality. Trials that ran longer and used higher amounts showed bigger effects on sleep onset and total sleep. The authors called the effects modest.1

NIH says melatonin may help with jet lag, delayed sleep-wake phase disorder and anxiety before surgery, but there is not enough strong evidence on its effectiveness or safety for chronic insomnia to recommend it.3

What does the magnesium research show?

A 2021 meta-analysis found 3 trials comparing oral magnesium with placebo in 151 older adults with insomnia. Time to fall asleep was about 17 minutes shorter on magnesium; total sleep was 16 minutes longer, but that was not statistically significant. All three trials had moderate to high risk of bias, and the evidence was rated low to very low quality.5

A 2026 review of 12 trials in adults found the results inconsistent across questionnaires, sleep EEG, activity trackers and body markers. It rated the certainty low to very low and concluded the evidence does not support magnesium as a routine treatment for insomnia, though it may give modest benefits on some self-reported measures.2

Has anyone compared them directly?

Not as a sleep treatment. One 8-week trial in 84 women with polycystic ovary syndrome, aimed mainly at hormones and metabolism, gave magnesium, melatonin, both, or placebo. The abstract reports a significant drop in a sleep quality score in the melatonin and combined groups; it does not report one for magnesium alone.6 That is one small trial in a specific group, so it does not settle which works better for sleep.

What are the safety points?

  • Melatonin: short-term use appears safe for most people, but long-term data are lacking. People with epilepsy or on blood thinners should use it under medical supervision, and older adults may get daytime drowsiness. In a 2023 study, 22 of 25 melatonin gummies were inaccurately labeled, with 74% to 347% of the stated amount.3
  • Magnesium: very high amounts can cause magnesium toxicity. NIH sets the upper limit for supplemental magnesium at 350 mg a day for adults. It may interact with oral bisphosphonates and with tetracycline and quinolone antibiotics, and diuretics and proton pump inhibitors can affect magnesium levels.4

This is general information, not personal advice. More detail: the Melatonin and Magnesium Bisglycinate guides, Melatonin vs valerian: which sleep aid has better evidence? and Magnesium citrate vs magnesium glycinate: which form?.

This page summarizes labels and published studies. It is not personalized medical advice; confirm any dose or change with your prescriber.

Frequently asked questions

Is melatonin or magnesium better for sleep?+
No trial has compared them as a sleep treatment. Melatonin has a larger body of placebo-controlled trials with small effects;1 magnesium's evidence is low to very low certainty and inconsistent.2
How much faster does melatonin help you fall asleep?+
In a meta-analysis of 19 trials, about 7 minutes faster than placebo on average, with about 8 more minutes of total sleep.1
Does magnesium help older adults sleep?+
A 2021 meta-analysis of 3 small trials in 151 older adults found people fell asleep about 17 minutes sooner, but the evidence was rated low to very low quality.5
Can they be taken together?+
One trial cited here gave them together, in women with polycystic ovary syndrome, but it was not built to show whether the pair beats either alone for sleep. Magnesium may interact with some antibiotics and oral bisphosphonates, so check with your clinician.64
Can I track melatonin and magnesium in Dose Track?+
Yes. Log the time you take each one and add sleep notes.