Magnesium and melatonin do different jobs. Melatonin is a hormone that tells your body it’s night, so it has the clearer evidence for timing problems like jet lag or a body clock that runs late. Magnesium is a mineral with weaker, low-certainty evidence for sleep. For most people, the first step is neither: it’s better sleep habits, and if trouble sleeping lasts for months, a talk with your doctor about CBT for insomnia.
Below, we compare the two side by side, look at what the research really shows and explain how to decide which, if either, to try first.
This post contains links to our reviews. If you buy through a link on those pages we may earn a commission, at no extra cost to you. How we make money.
Not medical advice. Talk to your doctor or pharmacist before starting a supplement, especially if you take medicines.
Key takeaways
- Melatonin is a timing signal. It’s best studied for jet lag and for sleep that’s shifted later than you want.
- For everyday insomnia, melatonin’s effect is small. One large review found people fell asleep about 7 minutes faster on average.
- Magnesium’s evidence is weaker. A 2026 review found possible modest benefits, but low certainty, and said it isn’t supported as a routine insomnia treatment.
- Sleep habits and CBT for insomnia come first. The American College of Physicians recommends CBT-I as the first-line treatment for chronic insomnia.
- Both have cautions. Check with a doctor if you take medicines, have kidney problems, epilepsy, or are pregnant or breastfeeding.
What melatonin does
Melatonin is a hormone your brain makes in response to darkness. It helps set your body clock, and light at night can block it. Most supplements contain a synthetic version (NCCIH).
Because it works as a “time for bed” signal, melatonin has been studied most for problems with timing:
- Jet lag. Reviews found melatonin may reduce symptoms better than placebo after flights, though evidence on sleep quality was low quality (NCCIH).
- A body clock that runs late (delayed sleep-wake phase disorder). In one trial of 307 people, taking melatonin an hour before a set bedtime helped them fall asleep about 34 minutes earlier (NCCIH).
For general insomnia, the effect is smaller. A 2013 meta-analysis of 19 studies with 1,683 people found melatonin cut the time to fall asleep by about 7 minutes and added about 8 minutes of sleep on average (PLoS One, 2013). The American Academy of Sleep Medicine and the American College of Physicians found not enough strong evidence to recommend it for chronic insomnia (NCCIH).
What magnesium does
Magnesium is a mineral your body uses in hundreds of processes. You get it from foods, and it’s also sold in several supplement forms, such as glycinate, citrate and oxide. Experts don’t know exactly how it might affect sleep (Sleep Foundation).
The sleep research is thin:
- A 2021 review of three small trials in 151 older adults found people fell asleep about 17 minutes faster with magnesium. But all the trials had moderate to high risk of bias, and the authors called the literature “substandard” for making firm recommendations (BMC Complementary Medicine and Therapies, 2021).
- A 2026 review of randomised trials in adults found magnesium may offer modest benefits for some self-reported sleep measures. The findings were inconsistent and the certainty low or very low. Its conclusion: “Current evidence does not support oral magnesium as a routine treatment for insomnia” (Journal of Dietary Supplements, 2026).
Magnesium glycinate is the form most often suggested for sleep, partly because it tends to be gentle on the stomach. Citrate can cause digestive side effects, and oxide is harder to absorb (Sleep Foundation).

Magnesium vs melatonin: side by side
| Melatonin | Magnesium | |
|---|---|---|
| What it is | A hormone that signals night-time | A mineral found in many foods |
| Best studied for | Jet lag; a body clock that runs late | General sleep quality, mostly in small trials |
| Evidence for insomnia | Small average effect; not recommended for chronic insomnia by US guideline groups | Low or very low certainty; not supported as a routine treatment |
| Typical amounts | Many experts suggest starting at 0.5–1 mg, 30–60 minutes before bed | No more than 350 mg a day from supplements, unless a doctor advises otherwise |
| Common side effects | Headache, dizziness, nausea, sleepiness | Diarrhoea, nausea, stomach cramps at higher doses |
| Ask a doctor first if you | Have epilepsy, take blood thinners, are pregnant or breastfeeding, or are an older adult | Have kidney disease or take prescription medicines |
Sources: NCCIH, Sleep Foundation (melatonin dosage), Sleep Foundation (magnesium).
Which to try first?
Here’s how we’d think it through. It’s a starting point for a conversation with your doctor or pharmacist, not a prescription.
- Start with your habits. The NHS suggests getting up at the same time every day, relaxing for at least an hour before bed, keeping the bedroom dark and quiet, exercising during the day, and avoiding alcohol, tea or coffee within 6 hours of bed (NHS). These cost nothing and help whichever route you take.
- If sleep has been poor for months, see your doctor. The American College of Physicians strongly recommends cognitive behavioural therapy for insomnia (CBT-I) as the first-line treatment (NCCIH). The NHS says a GP may offer CBT face to face or through an online programme (NHS).
- If your problem is timing, melatonin is the one studied for it. Think jet lag, or a body clock that won’t let you fall asleep until very late. Use a low dose, for a short time.
- If you’d like a gentler-sounding option, know the evidence is weaker. Magnesium may help some people a little, but the research doesn’t let anyone promise that. Food sources are a sensible place to start.
Whichever you choose, keep a simple sleep diary for two weeks. It helps you and your doctor see whether anything has changed.
Can you take magnesium and melatonin together?
There’s little research on the pair. One small 2011 trial gave 43 care-home residents with insomnia a nightly mix of 5 mg melatonin, 225 mg magnesium and zinc for eight weeks, and found better sleep scores than placebo (J Am Geriatr Soc, 2011). But it tested all three at once in a very specific group, so it can’t tell you what magnesium adds, or what would happen for you.
The Sleep Foundation gives no specific advice on combining them and suggests checking with a doctor, because magnesium can interact with some medicines (Sleep Foundation). That’s our advice too. Many sleep products already combine several ingredients, which makes it more important to read the label. Our guide on how to read a supplement label shows how.
A product that contains both: Yu Sleep
Yu Sleep is a liquid sleep supplement we’ve reviewed. It lists 0.9 mg of melatonin, which is a low dose and one we see as a plus. Magnesium glycinate is in it too, but inside a 637 mg blend with six other ingredients, so the label doesn’t say how much magnesium you get.
One of those blend ingredients is 5-HTP, which the body turns into serotonin. Harvard Health notes that, in theory, any drug or supplement that affects serotonin can cause serotonin syndrome, a serious condition (Harvard Health). Many antidepressants also work on serotonin, so if you take one, or any other medicine that affects serotonin, don’t combine it with Yu Sleep without your doctor’s okay. The smallest pack is a two-month supply. Our Yu Sleep review covers every ingredient and who should skip it.

If you’re comparing melatonin products, our guide to liquid melatonin vs gummies vs tablets explains why low doses are common. For more on sleep, energy and simple habits, visit our Health & Fitness section.
FAQ
Is magnesium or melatonin better for sleep?
It depends on the problem. Melatonin has clearer evidence for timing issues such as jet lag. Magnesium’s evidence for sleep is low certainty. Neither is a strong treatment for long-term insomnia, where CBT-I is the recommended first step.
Is magnesium glycinate better than melatonin?
Not on the evidence we have. Magnesium glycinate is gentle on the stomach and often suggested for sleep, but trials are small and inconsistent. Melatonin is better studied, though its average effect on insomnia is modest.
Can I take magnesium and melatonin together?
Some products combine them, but there’s little research on the pair. Ask your doctor or pharmacist first, especially if you take medicines or have kidney problems.
How much melatonin should I start with?
Many experts suggest starting low, around 0.5 to 1 mg, 30 to 60 minutes before bed, according to the Sleep Foundation. Ask your doctor about what suits you.
Is it safe to take melatonin every night?
Short-term use appears safe for most people, but NCCIH says long-term safety information is lacking. If you find you need it every night, talk to your doctor.
Our honest take
If you only remember one thing: melatonin is about timing, magnesium is a maybe, and habits plus CBT-I beat both for long-term insomnia. If you do try a supplement, go low, go short and tell your doctor. If you’re weighing up a combined product, our honest Yu Sleep review sets out the pros, the cons and the 5-HTP caution.
Want more honest guides like this? Join the WholesomePaths newsletter. One email. Three areas of growth. Zero spam.