sleepinsomniaresearch

Magnesium vs melatonin for sleep: what each one actually does

One is a timing signal, one is a mineral, and neither is the first thing sleep doctors recommend.

Kevin CrabbeFounder7 min read

They work in completely different ways

Melatonin is a hormone your brain releases when it gets dark. It tells the body it is night. As a supplement, its main job is timing: moving your sleep window earlier or helping the body adjust to a new time zone.[1]

Magnesium is a mineral involved in hundreds of processes in the body, including nerve and muscle function. It is not a sleep hormone, and it does not signal night to the brain. The idea that it helps sleep comes mostly from its role in the nervous system and from a small number of trials.[7][6]

How much melatonin helps

A meta-analysis of 19 trials in people with primary sleep disorders found melatonin helped people fall asleep about 7 minutes faster and sleep about 8 minutes longer than placebo.[2] Those are real effects, but small ones.

Average benefit of melatonin over placebo

Ferracioli-Oda et al., 2013: 19 randomized trials, 1,683 participants with primary sleep disorders.

Faster sleep onset: 7.1 minutes. Longer total sleep: 8.3 minutes. Pooled averages across varied doses and populations. Individual results differ, and trials were mostly short.051015202530Faster sleep onset7.1 minutesLonger total sleep8.3 minutes
How to read this: Pooled averages across varied doses and populations. Individual results differ, and trials were mostly short. Source: Ferracioli-Oda et al. — Meta-analysis: melatonin for the treatment of primary sleep disorders
View the data table
Average benefit of melatonin over placebo
Group / comparisonValue (minutes)
Faster sleep onset7.1
Longer total sleep8.3

The American Academy of Sleep Medicine’s 2017 guideline suggests clinicians not use melatonin to treat chronic insomnia in adults. It is a weak recommendation based on very low-quality evidence from a few small trials. It does not cover jet lag, where melatonin has more support.[3][1]

The label may not match the bottle

In the US, melatonin is sold as a dietary supplement, so it is not held to the same standards as medicines. When researchers tested 25 melatonin gummy products, one contained no detectable melatonin. In the rest, the amount ranged from 74% to 347% of what the label said. Only 3 of the 25 were within 10% of the label.[4]

The heart failure question

In November 2025, researchers presented an observational study of about 130,000 adults with insomnia. Those with at least a year of melatonin prescriptions had a higher rate of heart failure over five years (4.6% versus 2.7%) than matched people with no melatonin prescription on record.[5]

That finding does not show melatonin causes heart failure. People prescribed melatonin for a long time may have had worse insomnia, depression, or other health problems to begin with, and over-the-counter use was not captured in the records. As of September 2026 it has appeared only as a conference abstract, not a peer-reviewed paper.[5] Still, it is a reason to treat long-term nightly melatonin as something to discuss with a doctor, not a harmless default.

How much magnesium helps

The best summary we found pooled three small randomized trials of 151 adults aged 55 and older with insomnia. Magnesium shortened the time to fall asleep by about 17 minutes compared with placebo. The change in total sleep time was not statistically significant. The authors rated the evidence as low to very low quality, and all three trials had moderate to high risk of bias.[6]

There is little good evidence in younger adults, and none that clearly shows one form, such as magnesium glycinate, works better for sleep than another. For adults, the upper limit for magnesium from supplements is 350 mg a day. Higher doses commonly cause diarrhea, and people with kidney disease should not take magnesium supplements without medical advice.[7]

So which should you choose?

  • Jet lag: melatonin, taken at the right time, has the most support. Ask a pharmacist about timing and dose. For a body clock that runs late, see a sleep specialist first.[1]
  • Occasional trouble falling asleep: neither has strong evidence. If you are thinking about magnesium, ask a pharmacist or doctor first, especially if you take other medicines.
  • Insomnia most nights for three months or more: talk to a doctor about CBT-I. It is the recommended first treatment, and supplements do not address what keeps chronic insomnia going.[9]

A third option that is not a pill

Hypnosis for sleep has its own evidence base, also limited. A systematic review of 24 studies found that just over half reported a sleep benefit, with few reported side effects, but many studies were small and of low quality.[8] Like the supplements above, it is best treated as something to try alongside good sleep habits, not a replacement for CBT-I.

For more on why CBT-I is hard to get and what to do meanwhile, read why CBT-I doesn't scale. For how the body clock works, see circadian rhythm in plain English.

Frequently asked questions

Is magnesium or melatonin better for sleep?

They do different things. Melatonin is a timing signal, with the most support for jet lag. Magnesium is a mineral with weak evidence for insomnia, mostly from small trials in older adults. For ongoing insomnia, neither is first-line. Cognitive behavioral therapy for insomnia (CBT-I) is.

Can I take magnesium and melatonin together?

Many combination products exist, but there is little research on taking them together. Ask a pharmacist or doctor first, especially if you take other medicines or have kidney disease, since magnesium can build up when the kidneys do not clear it well.

Is it safe to take melatonin every night?

Short-term use appears safe for most adults. Long-term safety is less clear. A large observational study presented in 2025 linked long-term melatonin prescriptions to higher heart failure risk in people with insomnia. It could not show that melatonin caused it, but it is a reason to talk to a doctor rather than take melatonin nightly for years on your own.

Want to try a non-supplement wind-down? Explore free sleep hypnosis sessions in Hypnova.

Sources and further reading

  1. NCCIH — Melatonin: What You Need To Know

    NIH overview of melatonin research for jet lag, sleep disorders, and insomnia, plus safety and regulation of supplements.

  2. Ferracioli-Oda et al. — Meta-analysis: melatonin for the treatment of primary sleep disorders

    PLoS One, 2013;8(5):e63773. Meta-analysis of 19 randomized trials with 1,683 participants.

  3. Sateia et al. — Clinical practice guideline for the pharmacologic treatment of chronic insomnia in adults

    American Academy of Sleep Medicine. Journal of Clinical Sleep Medicine, 2017;13(2):307–349.

  4. Cohen et al. — Quantity of melatonin and CBD in melatonin gummies sold in the US

    JAMA, 2023;329(16):1401–1402. Laboratory analysis of 25 gummy products.

  5. American Heart Association — Long-term use of melatonin supplements to support sleep may have negative health effects

    News release on a preliminary observational study (Nnadi et al.) presented at AHA Scientific Sessions 2025, using TriNetX health records for 130,828 adults with insomnia.

  6. Mah & Pitre — Oral magnesium supplementation for insomnia in older adults: a systematic review and meta-analysis

    BMC Complementary Medicine and Therapies, 2021;21:125. Three randomized trials, 151 adults aged 55 and older.

  7. NIH Office of Dietary Supplements — Magnesium fact sheet

    Recommended intakes, upper limits for supplements, side effects, and medication interactions.

  8. Chamine, Atchley & Oken — Hypnosis intervention effects on sleep outcomes: a systematic review

    Journal of Clinical Sleep Medicine, 2018;14(2):271–283. Review of 24 studies using hypnosis with at least one sleep outcome.

  9. Edinger et al. — Behavioral and psychological treatments for chronic insomnia disorder in adults

    American Academy of Sleep Medicine clinical practice guideline. Journal of Clinical Sleep Medicine, 2021;17(2):255–262.

Evidence checked September 25, 2026. This is an editorial research summary by the Hypnova team, not a systematic review or a clinical assessment. Cited studies evaluate their own interventions; they do not establish that Hypnova produces the same outcomes. This article is educational and does not replace individualized care.

Keep reading