Key takeaways
- Melatonin and magnesium do fundamentally different jobs. Melatonin is a circadian timing signal: it tells your body when to sleep. Magnesium is a nervous system relaxant: it helps your body actually stay asleep.
- Neither is universally better. Melatonin suits circadian disruption (jet lag, shift work, delayed sleep phase). Magnesium suits anxiety-driven or poor-quality sleep, nighttime wakings, and muscle tension at night.
- Research suggests magnesium deficiency is common in modern diets and directly linked to elevated cortisol, neurological excitability, and disrupted sleep. Supplementation at clinical doses has shown measurable improvements in sleep quality in multiple trials.
- Melatonin's evidence for improving sleep quality in people with a normal circadian rhythm is modest. Ferracioli-Oda et al. (2013, PMID 23691095) pooled 19 RCTs and found melatonin reduced sleep onset latency by 7.06 minutes and increased total sleep time by 8.25 minutes — statistically significant but smaller than benzodiazepines (10–19.6 min reduction).
- The two can be taken together safely and work through entirely separate pathways. Djokic et al. (2019, PMC6910806) examined a magnesium-melatonin-B complex combination in 60 insomnia patients over three months and found improvements in Athens Insomnia Scale scores versus a control group.
- For most adults whose sleep problems stem from stress, a racing mind, or nighttime wakings, the evidence points more clearly toward magnesium. SleepStack provides 275mg elemental magnesium bisglycinate, the dose and form used in clinical sleep research, with no melatonin, no hormones, and a 30-night money-back guarantee.
Which is actually better for sleep: magnesium or melatonin?
The short answer: it depends on why you're not sleeping.
Melatonin is a hormone your pineal gland already produces. It rises naturally as the light fades in the evening, signalling to your body that night has arrived. Supplemental melatonin mimics that signal. It does not knock you out the way a sedative does. It adjusts the timing of your sleep window. If your problem is when you sleep (you can't fall asleep until 2am, you have jet lag, you work rotating shifts), melatonin can help re-anchor your internal clock.
Magnesium works through a completely different mechanism. It does not touch your circadian rhythm. It operates on the nervous system, activating GABA receptors, blocking NMDA receptors, and reducing cortisol. The result is a quieter physiological state at bedtime. If your problem is lying awake with a racing mind, waking at 3am for no clear reason, or sleeping lightly without feeling restored, magnesium addresses the biology behind that pattern.
The "which is better" framing is somewhat misleading because these supplements are not competing in the same category. One is a timing signal; the other is a nervous system relaxant.
That said, most adults who struggle with sleep are not dealing with jet lag. They are dealing with chronic low-grade stress, hyperarousal, and a nervous system that does not properly downregulate at night. For that profile, which describes the majority of people searching this comparison, the evidence tilts toward magnesium as the more directly relevant intervention.
The NIH estimates that a significant proportion of US adults consume below the Recommended Dietary Allowance for magnesium, and low magnesium is directly associated with elevated cortisol, heightened neurological excitability, and disrupted sleep architecture. Correcting that gap through supplementation has shown consistent improvements in sleep onset, sleep duration, and nighttime wakings in clinical research.
Melatonin's effects on sleep quality, separate from timing, are more limited when circadian disruption is not the issue. For general insomnia without a circadian component, the evidence is considerably thinner.
Form matters enormously for magnesium. Ranade & Somberg (2001, PMID 11550076) classified magnesium oxide's bioavailability as "extremely low" and grouped chelated forms like glycinate (bisglycinate) among the better-absorbed salts. Schuette et al. (1994, PMID 7815675) compared the two forms directly in patients with ileal resection and found glycinate delivered roughly twice the bioavailable magnesium of oxide. If someone has tried magnesium and it did not work, the form is often the reason.
How do magnesium and melatonin actually work?
Melatonin: the timing signal
Melatonin is synthesised in the pineal gland from serotonin in response to darkness. As light levels fall in the evening, the suprachiasmatic nucleus (the brain's master clock) releases the inhibition on the pineal gland, melatonin secretion begins, and the body enters its preparation-for-sleep cascade. Core body temperature drops. Growth hormone is released. Digestive activity slows.
Supplemental melatonin mimics this signal. Because the process is about timing, not sedation, the dose relationship is not linear. More does not mean better sleep. Research consistently shows doses as low as 0.3mg are as effective as 5-10mg for circadian adjustment, with fewer next-day side effects. The 5mg and 10mg products sold at most pharmacies are well above the physiological threshold.
The limitation of melatonin as a long-term sleep strategy is that it does not address why the nervous system is unable to settle. Many long-term users report that it works initially and then seems to lose effect, requiring dose increases to maintain the same result. Some researchers attribute this to psychological habituation rather than physiological desensitisation, though the mechanisms are not fully established.
Magnesium: the nervous system off-switch
Magnesium is involved in over 300 enzymatic reactions in the body and serves as the body's natural calcium antagonist inside cells. For sleep specifically, four mechanisms are relevant.
GABA receptor modulation. Gamma-aminobutyric acid (GABA) is the brain's primary inhibitory neurotransmitter, the signal that tells neurons to slow down. Magnesium enhances GABA receptor activity, promoting the transition from active waking brain states to the quieter states associated with sleep onset. The same pathway is targeted, far more aggressively, by benzodiazepines and Z-drugs.
NMDA receptor antagonism. N-methyl-D-aspartate (NMDA) receptors are excitatory. Magnesium blocks them, reducing the overall excitability of the nervous system. Under conditions of magnesium deficiency, NMDA receptors become overactive, contributing to the wired, hyperaroused state many poor sleepers describe.
Cortisol regulation. Low magnesium is associated with elevated cortisol. Cortisol follows a diurnal rhythm, low at night and peaking in the morning, but chronic stress disrupts this pattern. Supplementation has been shown in research to reduce cortisol response, which is directly relevant to nighttime wakefulness and the early-morning cortisol spike that wakes many people at 3-4am.
Muscle relaxation. Magnesium regulates the calcium-signalling mechanism that controls muscle contraction. Low magnesium allows excess calcium inside muscle cells, resulting in increased tension, cramps, and the restless-legs-adjacent sensations that disturb sleep in many people without their realising it. Users in supplement and sleep communities frequently report that supplementing magnesium reduced leg cramps or muscle tension they hadn't consciously connected to their sleep difficulty.
The glycine synergy
Magnesium glycinate pairs magnesium with glycine, an amino acid with its own sleep-relevant properties. Research suggests glycine independently lowers core body temperature, an important physiological step in entering deep sleep, and has been shown to improve subjective sleep quality in human trials. This makes the glycinate form more than just a delivery vehicle. The glycine molecule is itself contributing to the sleep effect.
The research in detail
What studies show about magnesium and sleep
Abbasi et al. (2012, PMID 23853635) examined 46 elderly subjects with primary insomnia over eight weeks. Those receiving 500mg elemental magnesium (as magnesium oxide) showed significant improvements in insomnia severity (p<0.001), sleep efficiency (p=0.03), and sleep onset latency (p=0.02), with marginal improvement in early morning awakening (p=0.08). Total sleep time did not change significantly (p=0.37). Serum cortisol decreased (p=0.008) and serum melatonin increased (p=0.007) relative to placebo.
Djokic et al. (2019, PMC6910806) examined a multi-ingredient combination supplement containing 175mg liposomal magnesium oxide, 1mg melatonin, vitamin B6 (10mg), vitamin B12 (16µg), and folate (600µg Extrafolate-S) in 60 insomnia patients (30 study / 30 control) over three months. The study group's Athens Insomnia Scale (AIS) score fell from 14.93 (moderate insomnia) to 10.50 (mild insomnia), while the control group was essentially unchanged (p=0.000 for the difference). The trial supports the broad idea that these supplements can be combined usefully. Important caveats: it was not a true placebo-controlled double-blind trial, the formulation is multi-ingredient so magnesium's specific contribution can't be isolated, and it used oxide rather than glycinate.
At the population level, Zhang et al. (2022, DOI: 10.1093/sleep/zsab276) analysed 3,964 participants in the CARDIA cohort and found those in the highest magnesium intake quartile were significantly less likely to report short sleep (<7 hours) than the lowest quartile (OR 0.64; 95% CI 0.51–0.81). Sleep quality showed a borderline association (p=0.051) that was stronger in participants without depression. The populations most likely to fall below dietary requirements — older adults (absorption declines with age), people under sustained stress, and those on certain medications — are also the populations with the highest rates of sleep complaints (NIH ODS).
What studies show about melatonin and sleep
The evidence base for melatonin is solid but narrower than its market penetration would suggest. The strongest evidence is for three specific use cases: jet lag, shift work disorder, and delayed sleep phase syndrome. For these circadian conditions, melatonin at low doses (0.3-1mg) taken at the appropriate time is a well-supported intervention with a clear mechanism.
For general insomnia without a circadian component, the evidence is more modest. Ferracioli-Oda et al. (2013, PMID 23691095) pooled 19 randomised trials covering 1,683 subjects and found melatonin reduced sleep onset latency by 7.06 minutes (95% CI 4.37–9.75; p<0.001), increased total sleep time by 8.25 minutes (95% CI 1.74–14.75; p=0.013), and improved sleep quality modestly (SMD 0.22; p<0.001). The authors noted these effects are smaller than pharmacological sleep aids (benzodiazepines reduce sleep latency by 10.0–19.6 minutes) but that melatonin has a more benign side-effect profile and no evidence of tolerance. For someone whose core problem is anxiety, rumination, or physiological hyperarousal at bedtime, a 7-minute faster sleep onset is meaningful but limited.
The dose issue is significant. Most commercially sold melatonin products range from 3mg to 10mg. These doses are 10 to 30 times the body's natural nocturnal melatonin peak (approximately 0.3mg). Supraphysiological doses can cause next-day grogginess, vivid dreams, and, in some research, headaches. They do not produce better circadian signalling than lower doses. They produce the same signal at higher receptor saturation with more side effects.
Magnesium form and absorption: why it matters clinically
The gap between magnesium forms is not trivial.
| Magnesium form | Bioavailability | Notes |
|---|---|---|
| Magnesium oxide | Extremely low | Most common in cheap supplements and gummies |
| Magnesium citrate | Good | Well absorbed; laxative side effect at higher doses |
| Magnesium chloride | Good | Often used in topical products |
| Magnesium glycinate (bisglycinate) | High | Chelated, gentle on GI, synergistic glycine |
Ranade & Somberg (2001, PMID 11550076) classified oxide as "extremely low" bioavailability. Schuette et al. (1994, PMID 7815675) found glycinate delivered roughly twice the bioavailable magnesium of oxide in a direct head-to-head comparison. The form difference is the difference between a supplement that moves the needle and one that does not.
How much should you take, and when?
Magnesium dosing for sleep
Clinical research on magnesium and sleep has used doses ranging from 200mg to 500mg elemental magnesium. The NIH Recommended Dietary Allowance for adults is 310-420mg depending on age and sex (higher for men, higher for pregnant women). The NIH tolerable upper limit for supplemental magnesium in adults is 350mg, above which GI effects become more likely, though glycinate is considerably more forgiving than oxide or citrate at equivalent doses.
For sleep-specific supplementation, 200-400mg elemental magnesium glycinate taken 30-60 minutes before bed is the protocol studied in most relevant research. At 275mg elemental magnesium per serving as bisglycinate, this sits squarely in the evidence-based range.
Magnesium does not produce immediate sedation. The effect is cumulative as tissue magnesium levels normalise over days to weeks of consistent use. Most users report a noticeable shift in their ability to wind down within the first one to two weeks.
Melatonin dosing for sleep
| Use case | Recommended dose | Timing |
|---|---|---|
| Jet lag (travelling east) | 0.3-1mg | At bedtime in the new time zone for 3-5 nights |
| Jet lag (travelling west) | 0.3-1mg | At bedtime in the new time zone for 2-3 nights |
| Delayed sleep phase | 0.3-1mg | 1-2 hours before desired bedtime, nightly |
| Shift work | 0.3-1mg | At intended sleep time |
| General insomnia | Evidence is weaker; if trying, start at 0.5mg | 30-60 min before bed |
The clearest practical takeaway from the research: if you are currently taking 5mg or 10mg of melatonin and experiencing grogginess the following morning, a significant dose reduction to 0.5-1mg is worth trialling. For most users, the lower dose is equally or more effective.
Taking both together
Magnesium and melatonin have no known adverse interactions and work through entirely separate pathways. Djokic et al. (2019, PMC6910806) showed a magnesium-melatonin-B complex combination improved insomnia severity over three months in 60 patients — supportive, though the multi-ingredient formulation and unblinded control make it less conclusive than an isolated head-to-head. A reasonable combined protocol for someone dealing with both circadian disruption (shift work, jet lag, or a significantly delayed sleep phase) and anxiety-driven sleeplessness:
- 0.5-1mg melatonin taken 60-90 minutes before desired bedtime
- 200-400mg magnesium glycinate taken 30-60 minutes before bed
| Supplement | Research dose range | Best timing | Best suited to |
|---|---|---|---|
| Magnesium glycinate | 200-400mg elemental | 30-60 min before bed | Anxiety at bedtime, nighttime wakings, poor sleep quality, muscle tension |
| Melatonin | 0.3-1mg | 60-90 min before desired bedtime | Jet lag, shift work, delayed sleep phase |
| Both together | As above | As above | Circadian disruption combined with anxiety-driven sleep issues |
Who should take which, and who should be cautious?
Magnesium is likely the better fit if:
- You fall asleep eventually but wake during the night, particularly in the early hours
- You feel anxious, tense, or mentally wired at bedtime even when physically tired
- You have muscle tension, leg cramps, or restless sensations at night
- You are under sustained stress or have been for some time
- You are an older adult (magnesium absorption and dietary intake both decrease with age)
- You have tried melatonin, it worked initially, and now seems less effective
Melatonin is likely the better fit if:
- You have jet lag or cross time zones regularly
- You do shift work and need to sleep at socially atypical hours
- Your sleep window is consistently delayed, you cannot fall asleep until 2am or later and struggle to wake at a conventional time
- You have a diagnosed circadian rhythm disorder (DSPS, non-24)
Children
Melatonin is frequently used in children, particularly those with ADHD and autism spectrum disorder, where delayed sleep onset is common. Short-term use under medical supervision appears generally safe. Long-term use in children is not well-studied, and some paediatric endocrinologists have flagged uncertainty about effects on pubertal development with extended use. Melatonin may help children fall asleep faster but does not necessarily improve sleep quality through the night.
For children specifically, any supplementation should be discussed with a paediatrician first. Paediatric magnesium RDAs are considerably lower than adult RDAs (80mg for ages 1-3 up to 240mg for ages 9-13 per NIH figures), and supplement dosing is not the same as adult dosing.
ADHD
ADHD is associated with both delayed circadian rhythm (making melatonin relevant for the sleep-onset component) and chronic hyperarousal at bedtime (making magnesium relevant for the nervous system component). Many adults and parents of children with ADHD report using both in combination, with melatonin for sleep timing and magnesium for the mental restlessness that makes falling asleep difficult regardless of the time. Online ADHD communities have active discussions on this combination, with broadly positive anecdotal reports for magnesium glycinate specifically.
Consulting a doctor familiar with ADHD is recommended before starting either supplement, as stimulant medications already affect sleep architecture and the interaction picture is more complex.
Older adults
Both absorption efficiency and dietary intake of magnesium decline with age. Several clinical trials showing the strongest sleep improvements from magnesium supplementation were conducted specifically in older adults. Older adults are also more sensitive to residual melatonin effects, making lower doses (0.3-0.5mg) even more important in this group.
A note on limitations
Neither supplement works for everyone, and both have a ceiling. Sleep disorders have many causes, including sleep apnoea, restless leg syndrome, depression, medication side effects, chronic pain, and structural sleep hygiene problems, that no supplement addresses. If sleep problems are severe, have persisted for months, or are meaningfully affecting daily functioning, a consultation with a doctor or sleep specialist is the appropriate first step. Supplements are not a substitute for clinical evaluation.
How to choose a magnesium supplement for sleep
If you decide to try magnesium for sleep, the form is the most important variable, more important than brand, price tier, or delivery format. Avoid magnesium oxide (the most common form in gummies and low-cost tablets) and any product that does not specify the elemental magnesium content on the label.
What to look for:
- Magnesium glycinate or bisglycinate: The chelated form with the highest absorption and lowest GI side effect profile
- Elemental magnesium dose of 200-400mg per serving: Check the label carefully. Many products list the magnesium salt weight (which is much higher) rather than the elemental content
- Label transparency: The ingredient list should be short and legible; proprietary blends hide what you're actually getting
- No unnecessary additions: Melatonin, herbal blends, and "sleep complex" marketing usually add cost without adding evidence-backed benefit for most users
- Third-party testing: NSF, USP, or Informed Sport certification where available
| Brand | Form | Elemental Mg per serving | Price/month |
|---|---|---|---|
| SleepStack | Magnesium bisglycinate | 275mg (3 capsules) | $29.99 ($23.99 on subscription) |
| Nature Made | Magnesium glycinate | 200mg | ~$12–22 |
| NOW Foods | Magnesium glycinate | 200mg (2 tablets) | ~$18 |
| Pure Encapsulations | Magnesium glycinate | 120mg | ~$27 |
| Thorne | Magnesium bisglycinate | 200mg | ~$26 ($52 for 60 servings) |
| BIOptimizers | Magnesium blend (7 forms) | Varies | ~$35 |
SleepStack is a single-ingredient magnesium bisglycinate at 275mg elemental magnesium: the clinical dose, the right form, no melatonin, no proprietary blend. The 30-night money-back guarantee means the decision is low-risk. If sleep does not improve in 30 nights, you get a refund.
Frequently asked questions
Is magnesium or melatonin better for sleep?
For most adults, magnesium is the more broadly applicable option. Melatonin is most effective for circadian disruption: jet lag, shift work, or a consistently delayed sleep window. Magnesium is more directly relevant for anxiety-driven sleep problems, frequent nighttime wakings, and poor sleep quality. If the core issue is a nervous system that won't settle at night, magnesium addresses the physiological root of that more directly than melatonin does.
Can you take magnesium and melatonin together?
Yes. Magnesium and melatonin work through entirely different mechanisms and have no known adverse interactions. Djokic et al. (2019, PMC6910806) tested a magnesium-melatonin-B complex combination in 60 insomnia patients over three months and reported improvements on the Athens Insomnia Scale compared to a control group (though the trial used oxide rather than glycinate and a multi-ingredient formulation). A common approach for combining them is low-dose melatonin (0.3-1mg) for timing, combined with magnesium glycinate (200-400mg elemental) for nervous system relaxation.
What dose of melatonin should I take for sleep?
Research consistently shows doses of 0.3-1mg are effective for circadian signalling, producing the same effect as 5-10mg products with fewer side effects. If you are currently taking 5mg or more and experiencing morning grogginess, try reducing to 0.5-1mg first. Commercial products are often sold at doses 10-30 times higher than the physiological threshold.
How long does magnesium take to work for sleep?
Magnesium is not a one-night intervention. Most users report a noticeable difference within one to two weeks of consistent nightly use. Unlike melatonin, the effect is cumulative. It reflects normalising tissue magnesium levels over time rather than an acute hormonal signal.
Is it safe to take magnesium every night long-term?
For most adults, yes. Magnesium is an essential mineral, and nightly supplementation at 200-400mg elemental is within the range of the daily dietary requirement. The NIH sets the tolerable upper limit for supplemental magnesium at 350mg for adults, above which GI effects become more common, though glycinate is significantly gentler than oxide or citrate at equivalent doses. Anyone with kidney disease should speak to a doctor before supplementing, as the kidneys control magnesium excretion and kidney impairment changes the risk profile.
Does melatonin lose effectiveness over time?
Many regular users report that melatonin appears to work less well with extended use. The mechanism is not fully established. Some researchers attribute it to psychological habituation rather than physiological desensitisation. Taking periodic breaks and using the minimum effective dose (often 0.5-1mg rather than 5-10mg) can help maintain effectiveness.
Which is better for sleep problems related to ADHD?
ADHD is associated with both delayed circadian rhythm and hyperarousal at bedtime. Melatonin has some clinical support for improving sleep onset in ADHD, particularly in children. Magnesium may help with the hyperarousal component, the difficulty quieting mental activity regardless of the clock time. Many adults with ADHD and parents of children with ADHD use both in combination. Because ADHD management already involves other interventions, consulting a doctor before adding either supplement is the sensible approach.
Is magnesium or melatonin better for children's sleep?
This depends on the cause of the sleep difficulty. Melatonin is more commonly used for children with ADHD or autism where delayed sleep onset is the primary issue. Magnesium is sometimes used for anxiety or hyperarousal at bedtime. Both should be discussed with a paediatrician before use in children. Paediatric dosing is not the same as adult dosing, and long-term melatonin use in children has not been extensively studied.
What does the research say about melatonin for sleep quality (not just timing)?
For people without circadian disruption, the evidence is modest. Ferracioli-Oda et al. (2013, PMID 23691095) pooled 19 RCTs and found melatonin reduced sleep onset latency by 7.06 minutes and increased total sleep time by 8.25 minutes. These are statistically significant improvements but limited in practical size for someone whose sleep problem is anxiety, racing thoughts, or poor quality rather than getting to bed at the wrong time.
Why do some users prefer magnesium glycinate over melatonin for sleep?
Across sleep, supplement, and ADHD communities online, the commonly reported experience with magnesium glycinate is one of calm without sedation — falling asleep more naturally, sleeping more soundly, and not waking up groggy. Users frequently mention noticing that leg cramps or restlessness they hadn't consciously connected to their sleep improved. The absence of a hormonal mechanism also appeals to people cautious about exogenous hormones. The broad contrast users describe is that melatonin feels like an added drug while magnesium feels more like removing a physiological obstacle to sleep.
Sources
- Ferracioli-Oda E, Qawasmi A, Bloch MH. (2013). Meta-Analysis: Melatonin for the Treatment of Primary Sleep Disorders. PLOS ONE 8(5):e63773. PMID: 23691095; DOI: 10.1371/journal.pone.0063773
- Djokic G, Vojvodić P, Korcok D, et al. (2019). The Effects of Magnesium-Melatonin-Vit B Complex Supplementation in Treatment of Insomnia. Open Access Macedonian Journal of Medical Sciences 7(18):3101–3105. PMC6910806; DOI: 10.3889/oamjms.2019.771
- Abbasi B, Kimiagar M, Sadeghniiat K, Shirazi MM, Hedayati M, Rashidkhani B. (2012). The effect of magnesium supplementation on primary insomnia in elderly: A double-blind placebo-controlled clinical trial. Journal of Research in Medical Sciences. PMID: 23853635
- Zhang Y, Chen C, Lu L, et al. (2022). Association of magnesium intake with sleep duration and sleep quality: findings from the CARDIA study. SLEEP 45(4). DOI: 10.1093/sleep/zsab276
- Ranade VV, Somberg JC. (2001). Bioavailability and pharmacokinetics of magnesium after administration of magnesium salts to humans. American Journal of Therapeutics 8(5):345–357. PMID: 11550076
- Schuette SA, Lashner BA, Janghorbani M. (1994). Bioavailability of magnesium diglycinate vs magnesium oxide in patients with ileal resection. JPEN J Parenter Enteral Nutr 18(5):430–435. PMID: 7815675
- National Institutes of Health, Office of Dietary Supplements. Magnesium: Fact Sheet for Health Professionals. ods.od.nih.gov/factsheets/Magnesium-HealthProfessional/
- National Institutes of Health, Office of Dietary Supplements. Magnesium: Fact Sheet for Consumers. ods.od.nih.gov/factsheets/Magnesium-Consumer/
Related reading
vs-melatonin
Can You Take Magnesium and Melatonin Together? (2026)
Yes, magnesium and melatonin are safe to combine, and one 3-month trial showed better sleep. See the right dose, timing, and who should avoid mixing them.
Read the article →vs-melatonin
Magnesium and Melatonin: Can You Take Them Together?
Can you take magnesium and melatonin together? A research-backed look at how they interact, dosing, side effects, and who should pair them.
Read the article →vs-melatonin
Best Magnesium Melatonin Supplements: 4 Combos (2026)
Compare 4 top magnesium melatonin combo supplements for sleep, dose-by-dose. What research shows, who each is for, and when to skip the combo.
Read the article →vs-melatonin
Magnesium Glycinate vs Melatonin: What Research Says
Magnesium glycinate calms the nervous system. Melatonin shifts your body clock. See which fits your sleep issue, with study-backed doses and pros.
Read the article →