
Sometime in 2023, magnesium stopped being a mineral and became a nightcap. A wellness creator posted a recipe on TikTok, half a cup of tart cherry juice, a spoonful of magnesium powder, a splash of prebiotic soda, called it the sleepy girl mocktail, and the video passed a million and a half views. By the following January the hashtag had another four million [1].
Which is roughly how the melatonin ended up in the drawer. The bottle on the nightstand is magnesium now. Someone in a comment or a thread or a TikTok swore this was the one that would settle the nights, and people believed it long enough to place the order.
How does magnesium help you sleep? The popular answer is that a mineral calms nerves and muscles in a way a hormone pill never did. The honest answer is that the trials are small, and the reviewers who pooled them rated the evidence too weak for a doctor to recommend [2].
Magnesium didn't beat melatonin on evidence. It won the nightstand. When Rest counted more than 1,000 recommendations in a viral sleep thread, magnesium was the most mentioned intervention, 58 times. Melatonin, the bottle everyone still thinks of as "the sleep supplement," showed up 28 times.
Why Is Everyone Taking Magnesium for Sleep?
If you'd asked a drugstore five years ago, melatonin was the default: a hormone sold like a sleeping pill, sitting next to the toothpaste. The internet got tired of it. Dose advice in that thread ran from 3 mg to 40 mg, a 13-fold spread, with no agreement on gummies versus tablets or on when to take them. A hormone you can buy in a 40 mg gummy starts to feel like a project, not a routine.
Magnesium arrived as the opposite story. It's in food. It sounds like nutrition, not like knocking yourself out. Taking it feels like filling a gap rather than taking a sleep drug, which is an easier thing to tell yourself if you've already decided you don't want another pill.
There's a joke buried in the recipe that started all this. Tart cherry juice contains melatonin. Nowhere near a gummy's worth, but enough that when researchers at Northumbria University gave 20 healthy adults the concentrate for a week in 2012, their melatonin levels rose and they slept longer [3]. The ritual that replaced melatonin has melatonin in it.
In the answers to the X viral thread, mouth tape also outranked melatonin. So did meal timing. And Cognitive Behavioral Therapy for Insomnia (CBT-I), the approach sleep medicine actually puts first for chronic insomnia [4], came up just three times in more than a thousand messages. The culture and the clinic aren't having the same conversation.
Does Magnesium Help You Sleep?
Ask around and you'll get roughly the same answer. Magnesium is the calm mineral. It loosens tight muscles, settles the nervous system, takes the edge off the day so sleep can happen on its own.
That explanation travels well because part of it is true. Magnesium really is involved in how nerves fire and how muscles relax, and it's a nutrient plenty of people don't get enough of [5].
The trouble is the jump from there to a capsule ending insomnia. A 2021 review in BMC Complementary Medicine and Therapies went looking for the trials in older adults and found three, with 151 people between them. The magnesium groups did fall asleep faster than the placebo groups. The authors' own verdict was blunter than any caption: the evidence, they wrote, was "substandard" for physicians to make a well-informed recommendation [2].
A second review, in Biological Trace Element Research, found the split that the popular version papers over. People who eat more magnesium (leafy greens, beans, nuts) do tend to report sleeping better, a pattern tracked across large groups of people over years. Hand people a supplement instead, compare it against a placebo, and the reviewers called the results uncertain [6].
The newest trial is the one the trend had been waiting for, and it came in small. In 2025, researchers in Hannover gave 155 adults who described their own sleep as poor either magnesium bisglycinate or a placebo. Insomnia scores fell further on magnesium, 3.9 points against 2.3, an effect the authors themselves called small, in people who had not been diagnosed with a sleep disorder. The interesting signal was in a subgroup: the biggest improvements came from the people who had been getting the least magnesium from food [7].
Magnesium does real work in your body. But nobody has shown that taking it ends insomnia.
Is Everyone Really Magnesium Deficient?
This is the part that makes magnesium feel safe. You're not medicating, you're topping up something modern life took away. And the first half of that is true: magnesium intake really does fall short for a lot of people, with 48% of Americans taking in less than the estimated average requirement for their age and sex [5].
The rest holds up less well. Falling below an intake target isn't the same as being deficient, and deficiency from diet alone is uncommon in otherwise healthy people, because the kidneys hold on to the mineral when intake drops [5]. The soil-depletion explanation everyone repeats isn't supported by the paper it's usually credited to. And a blood test can't settle it either, because less than 1% of the body's magnesium is in blood serum and that reading says little about the stores [5]. The whole argument, plus what actually separates glycinate from citrate from oxide, is here: are we all magnesium deficient?
Magnesium vs. Melatonin for Sleep: One Is a Clock, the Other Is a Nutrient
They sit on the same shelf, get bought for the same problem, and have almost nothing in common.
Melatonin is a hormone your brain already makes, and its main job is timekeeping rather than sedation. Its clearest use is a timing problem: a Cochrane review of trials in air travelers called melatonin "remarkably effective" at preventing or reducing jet lag after crossing five or more time zones [8].
That doesn't make it inert the rest of the time. Pooling 26 randomized trials, researchers found melatonin does shorten how long people take to fall asleep and does add a little total sleep [9]. But modest is the word, and it isn't what sleep medicine reaches for: the American Academy of Sleep Medicine's guideline on sleep drugs suggests clinicians not use melatonin for chronic insomnia, whether the trouble is falling asleep or staying asleep [10].
Magnesium isn't a signal at all. It's a mineral you need for hundreds of reactions in the body, including the ones that let nerves fire and muscles relax, and plenty of people's intake does fall short of the recommended amount [5]. Topping that up is worth doing for your health generally. It isn't a lever you pull at bedtime.
Melatonin is built for a timing problem. Magnesium is built for a shortfall. If your nights come apart for some other reason, neither supplement was aimed at it in the first place, which is why trading one for the other changes so little.
What did change is how it feels: something good for you instead of something strong enough to put you out. That's why it stays on the nightstand long after it stopped being an experiment.
When Magnesium Doesn't Work
There are two ways this usually goes, and both of them end at a checkout.
Some nights feel calmer, so you keep taking it and never really find out whether it did anything. Or nothing changes, and the internet has an answer ready: wrong form. Take it earlier. Take it with something else. There's always a next bottle.
What none of it reaches is the thing that keeps chronic insomnia going. Months of lying there trying to make sleep happen, checking the clock, adding up how many hours are left, spending more and more time in bed hoping some of it turns into sleep. That's a pattern, not a nutrient gap, and no capsule undoes it.
CBT-I is the part that works on the pattern, and one of its core moves is the one most people don't expect: adjusting how much time you spend in bed so that sleep consolidates, rather than adding something to take [4]. How long that takes is here: how long CBT-I takes to improve sleep. And years of bad nights don't disqualify you, you can still rebuild your sleep.
Rest, which ran that count and publishes this article, is a program built on the principles of CBT-I, plus circadian biology and neuroscience, with Dr. Ashley Mason, PhD, of UCSF as its lead scientific advisor. It coaches those changes in short daily conversations, by text or by voice, and adapts as the nights change.
The Questions People Keep Asking
Why does magnesium help you sleep? The usual explanation is that magnesium relaxes muscles and calms the nervous system, and it is genuinely involved in both. What hasn't been shown is that a supplement treats insomnia. The trials are small, and where an effect turns up it is modest.
Does magnesium actually help with insomnia? Some people say it helps them and the research doesn't rule that out, but the studies are few and small. Sleep medicine doesn't list magnesium as a treatment for chronic insomnia.
Magnesium vs melatonin for sleep: which is better? They do different jobs: melatonin tells your body what time it is, and magnesium is a nutrient your body uses for hundreds of processes. For insomnia that's lasted months, neither is the first-line approach.
Why did people switch from melatonin to magnesium? Melatonin came to feel like a hormone project, with dose advice all over the map, while magnesium feels like food. In Rest's count of a viral sleep thread, magnesium was recommended 58 times and melatonin 28.
Can I take magnesium with my sleep medication? That depends on the medication and on how well your kidneys clear magnesium, so it's a question for the prescriber or a pharmacist who can look at your actual combination. Magnesium does interact with some drugs, including certain antibiotics and osteoporosis medications [5], and a prescribed sleep medication isn't something to change because of a trend.
If You Already Made the Swap
The mocktail moved on. The magnesium didn't. What's left is a drawer with a leftover melatonin, two magnesiums, and the same insomnia.
If that's your drawer, the problem was never which bottle you picked. Nothing on that shelf touches the part that actually runs the night: the hours of trying, the clock math, the time in bed that keeps stretching to catch sleep that doesn't come. That's behavior, and behavior shifts with practice and feedback, not with a supplement.
That's the part Rest works on. It's a program built on the behavioral principles of CBT-I, delivered as a short conversation each morning, by text or by voice, that reads how you actually slept and sets up the day around it. Start with Rest »
Disclaimer. This article is published for general information only. It is not medical advice or a diagnosis, and nothing here is a recommendation to take, avoid, or change any supplement or medication. Rest is not a substitute for professional medical care. Do not start, stop, or adjust a treatment, including a prescribed sleep medication, without talking to your clinician.
Citations
McCarthy, K. (2024, January). What is a sleepy girl mocktail? How to make the viral tart cherry juice pre-bedtime drink. ABC News / Good Morning America. https://abcnews.go.com/GMA/Food/sleepy-girl-mocktail-make-viral-tart-cherry-juice/story?id=106442503 — Recipe (tart cherry juice, magnesium powder, prebiotic soda) posted to TikTok in March 2023 by creator Gracie Norton, 1.5 million+ views; #sleepygirlmocktail a further 4.2 million; renewed surge during Dry January 2024.
Mah, J., & Pitre, T. (2021). Oral magnesium supplementation for insomnia in older adults: A systematic review & meta-analysis. BMC Complementary Medicine and Therapies, 21, 125. https://doi.org/10.1186/s12906-021-03297-z — Three RCTs, 151 older adults; time to fall asleep shorter than placebo; evidence rated too weak for physicians to make a well-informed recommendation.
Howatson, G., Bell, P. G., Tallent, J., Middleton, B., McHugh, M. P., & Ellis, J. (2012). Effect of tart cherry juice (Prunus cerasus) on melatonin levels and enhanced sleep quality. European Journal of Nutrition, 51(8), 909–916. https://doi.org/10.1007/s00394-011-0263-7 — Randomized, placebo-controlled crossover trial, 20 healthy adults, seven days of tart cherry juice concentrate; total urinary melatonin significantly elevated, with increases in time in bed, total sleep time and sleep efficiency.
Edinger, J. D., Arnedt, J. T., Bertisch, S. M., et al. (2021). Behavioral and psychological treatments for chronic insomnia disorder in adults: An American Academy of Sleep Medicine clinical practice guideline. Journal of Clinical Sleep Medicine, 17(2), 255–262. https://doi.org/10.5664/jcsm.8986 — CBT-I as first-line treatment for chronic insomnia in adults; sleep restriction (reducing time in bed) among the recommended components.
National Institutes of Health, Office of Dietary Supplements. Magnesium: Fact Sheet for Health Professionals. https://ods.od.nih.gov/factsheets/Magnesium-HealthProfessional/ (accessed August 2026) — Cofactor in more than 300 enzyme systems; adult body holds ~25 g, 50%–60% in bone, less than 1% in blood serum; 48% of Americans consume less than the EAR (NHANES 2013–2016); symptomatic deficiency from diet alone uncommon in otherwise healthy people; assessing status is difficult, serum has little correlation with total body magnesium and no single method is satisfactory; serum magnesium not part of routine electrolyte testing, and not measured nationally between 1974 and 2021 (this fact sheet still says no current U.S. data exist, which the 2026 NHANES analysis supersedes); soluble forms (citrate, lactate, chloride, aspartate) absorb more completely than oxide and sulfate; Supplement Facts declares elemental magnesium; can interact with some medications; no sleep or insomnia recommendation on this fact sheet.
Arab, A., Rafie, N., Amani, R., & Shirani, F. (2023). The role of magnesium in sleep health: A systematic review of available literature. Biological Trace Element Research, 201, 121–128. https://doi.org/10.1007/s12011-022-03162-1 — Observational dietary intake associated with sleep reports; supplement trials uncertain.
Schuster, J., Cycelskij, I., Lopresti, A., & Hahn, A. (2025). Magnesium bisglycinate supplementation in healthy adults reporting poor sleep: A randomized, placebo-controlled trial. Nature and Science of Sleep, 17, 2027–2040. https://doi.org/10.2147/NSS.S524348 — n=155 adults aged 18–65 with self-reported poor sleep, diagnosed sleep disorders excluded; Insomnia Severity Index fell 3.9 points vs 2.3 on placebo (p=0.049), effect size small (d=0.2); 250 mg elemental magnesium as bisglycinate with ~1.5 g glycine co-delivered; exploratory subgroup finding of largest improvements among those with the lowest baseline dietary magnesium.
Herxheimer, A., & Petrie, K. J. (2002). Melatonin for the prevention and treatment of jet lag. Cochrane Database of Systematic Reviews, (2), CD001520. https://doi.org/10.1002/14651858.CD001520 — "Melatonin is remarkably effective in preventing or reducing jet-lag"; recommended for adult travelers crossing five or more time zones. A circadian-timing use, not a sedative one.
Cruz-Sanabria, F., Bruno, S., Crippa, A., Frumento, P., Scarselli, M., Skene, D. J., & Faraguna, U. (2024). 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, 76(5), e12985. https://doi.org/10.1111/jpi.12985 — 26 randomized controlled trials, 1,689 observations, in patients with insomnia and healthy volunteers; melatonin gradually reduced sleep onset latency and increased total sleep time, with efficacy peaking around 4 mg/day. Establishes a modest sleep-promoting effect alongside the circadian one.
Sateia, M. J., Buysse, D. J., Krystal, A. D., Neubauer, D. N., & Heald, J. L. (2017). Clinical practice guideline for the pharmacologic treatment of chronic insomnia in adults: An American Academy of Sleep Medicine clinical practice guideline. Journal of Clinical Sleep Medicine, 13(2), 307–349. https://doi.org/10.5664/jcsm.6470 — "We suggest that clinicians not use melatonin as a treatment for sleep onset or sleep maintenance insomnia (versus no treatment) in adults" (WEAK recommendation).