Should I take melatonin or magnesium for sleep?
They do different jobs. Melatonin tells your body clock it’s evening, so the hour you take it changes what it does. Magnesium helped a little in a 2025 trial, where 155 adults with poor sleep took 250 mg a day or a placebo for 4 weeks, and their insomnia score dropped 3.9 points against 2.3, a small effect.
The two sit on the same shelf and get recommended in the same breath, so people treat them as rivals for the same job. Melatonin is about when you sleep, and magnesium, in the 2025 trial, nudged how bad people rated their insomnia.
We’d fix the hour and the light before adding either. If you want to try one, pick the one that fits your problem, take only that one for two weeks, and check your own nights. Taking both at once makes it impossible to tell which did anything.
Comparing them is like comparing a watch with a pillow. One tells your body what time it is, and the other might make the night a little more comfortable.
Side by side
| Melatonin | Magnesium | |
|---|---|---|
| What it does | Tells your body clock it’s evening, and nudges sleepiness | Small drop in insomnia symptoms in one 2025 trial |
| Best for | Falling asleep sooner, moving a late schedule, jet lag | People who eat little magnesium and sleep poorly |
| Dose studied | 0.5 to 1 mg to start, 5 mg the top | 250 mg of elemental magnesium as bisglycinate |
| When | 1 to 3 hours before bed, or about 5 hours before your usual bedtime to move earlier | Once a day in the trial |
| Size of the effect | About 7 minutes faster to fall asleep on average | 3.9 points against 2.3 on an insomnia score, a small effect |
The magnesium trial
In 2025, researchers in Hannover, Germany, randomly gave 155 adults aged 18 to 65 who said they slept poorly either magnesium bisglycinate, 250 mg of elemental magnesium a day, or a placebo. After 4 weeks, insomnia scores fell 3.9 points with magnesium and 2.3 with the placebo. The difference was small, and the authors called it a modest benefit. People who ate little magnesium seemed to gain more. Nothing else they measured changed, and sleep was self-reported, with no tracker or lab.
What melatonin does
Melatonin’s effect on falling asleep is small too, about 7 minutes faster on average across 19 trials, and it grows when it’s taken earlier, about 3 hours before bed in a 2024 analysis of 26 trials. Its bigger job is the clock. In a 2010 lab study, 0.5 mg taken in the afternoon moved people’s body clocks earlier, as far as 3 mg did. Magnesium has no timing job like that.
Before either one
Light reaches your body clock without any pill. In a 2011 study, ordinary room light before bed made melatonin start later in 99 percent of 116 young adults. Lamps instead of overhead lights, and a fixed wake time, are free.
If you take a prescription medicine every day, ask your prescriber before adding melatonin, magnesium or anything else. Don’t drive after a dose.
5 sources
- Schuster J and others, Magnesium bisglycinate supplementation in healthy adults reporting poor sleep: a randomized, placebo-controlled trial, Nature and Science of Sleep, 2025pubmed.ncbi.nlm.nih.gov
- Burgess HJ, Revell VL, Molina TA, Eastman CI, Human phase response curves to three days of daily melatonin: 0.5 mg versus 3.0 mg, Journal of Clinical Endocrinology and Metabolism, 2010pubmed.ncbi.nlm.nih.gov
- Ferracioli-Oda E, Qawasmi A, Bloch MH, Meta-analysis: melatonin for the treatment of primary sleep disorders, PLoS One, 2013pubmed.ncbi.nlm.nih.gov
- Cruz-Sanabria F and others, Optimizing the time and dose of melatonin as a sleep-promoting drug: a systematic review of randomized controlled trials and dose-response meta-analysis, Journal of Pineal Research, 2024pubmed.ncbi.nlm.nih.gov
- Gooley JJ and others, Exposure to room light before bedtime suppresses melatonin onset and shortens melatonin duration in humans, Journal of Clinical Endocrinology and Metabolism, 2011pubmed.ncbi.nlm.nih.gov