Magnesium has become one of the most talked-about sleep aids online, partly as an ingredient in the social media "sleepy girl mocktail". The National Center for Complementary and Integrative Health (NCCIH) says "there isn't enough rigorous scientific evidence to determine whether they are effective." Here is what the studies actually found, how to get magnesium from food and who should be careful with supplements. This guide does not suggest an amount to take; that is a conversation for your doctor or pharmacist.

What does magnesium do in the body?

Magnesium is a mineral that, according to MedlinePlus from the US National Library of Medicine, is "needed for more than 300 biochemical reactions in the body." Among its jobs, it supports nerve and muscle function, the immune system, a steady heart rhythm and bone strength, and it is involved in blood sugar control and the production of energy and protein.

That role in nerves and muscles is why people link magnesium with relaxation and sleep, but a plausible link is not proof that extra magnesium improves sleep.

True deficiency is uncommon. MedlinePlus says it is more likely in people who misuse alcohol, people who absorb nutrients poorly because of a digestive disease or surgery, older adults and people with type 2 diabetes.

What did systematic reviews of magnesium and sleep find?

Only a handful of small trials have tested magnesium for sleep. As NCCIH's overview of sleep disorders and complementary approaches puts it, "There is very little research on magnesium for insomnia." The main reviews and the largest recent trial look like this:

StudyWho took partWhat it found
2021 systematic review and meta-analysis3 randomized trials, 151 older adults with insomniaPeople fell asleep about 17 minutes sooner than with a placebo. Total sleep time rose by about 16 minutes, but that difference was not statistically significant. Evidence rated low to very low quality.
2022 systematic review9 studies, 7,582 adults, mixing observational studies and trialsObservational studies suggested a link between magnesium status and sleep. The trials reported contradictory findings.
2025 randomized trial155 adults aged 18–65 who reported poor sleepA small improvement on an insomnia questionnaire after four weeks, with no clear difference in other measures.

Does magnesium help older adults with insomnia?

It might help a little, but the evidence is weak. The 2021 review, published in BMC Complementary Medicine and Therapies, pooled three trials of older adults with insomnia. On average, people taking magnesium fell asleep 17.36 minutes sooner than people taking a placebo. However, all three trials had a moderate to high risk of bias, and NCCIH summarizes the reviewers' verdict as studies "of low quality and inadequate for making well-informed decisions on using magnesium."

The 2022 review in Biological Trace Element Research looked more widely. Its observational studies, which compare people's magnesium levels or intake with how they sleep, linked magnesium with outcomes such as daytime sleepiness, snoring and sleep duration. Studies like these cannot show that magnesium causes better sleep. The trials in the same review disagreed with one another, and the authors called for larger, well-designed trials lasting more than 12 weeks.

Does a magnesium supplement help adults who sleep badly?

The largest recent trial, published in Nature and Science of Sleep in 2025, randomly assigned 155 adults who reported poor sleep to take either magnesium bisglycinate or a placebo. After four weeks, scores on the Insomnia Severity Index fell by 3.9 points with magnesium and by 2.3 points with the placebo. The authors described the effect as small and concluded that magnesium "modestly improved insomnia severity".

A few details put that result in context:

  • The placebo group improved too, so much of the change also happened without magnesium.
  • Sleep was measured only by questionnaire, not with sleep monitoring.
  • The average score in the magnesium group was still in the subthreshold insomnia range at week four. The authors wrote that supplementation alone "is unlikely to eliminate insomnia in many individuals."
  • An exploratory analysis hinted that people who ate less magnesium improved more, but intake was judged from a single question, so this needs testing properly.

Which foods are high in magnesium?

MedlinePlus says "Most dietary magnesium comes from dark green, leafy vegetables." It lists these other good sources:

Food groupExamples
Dark green, leafy vegetablesSpinach and other leafy greens
NutsAlmonds, cashews
Legumes and seedsBeans, lentils and seeds
Soy foodsTofu, soy flour
Whole grainsBrown rice, millet
FruitBananas, dried apricots, avocados
DairyMilk

The Recommended Dietary Allowances (RDAs) below come from the Food and Nutrition Board of the National Academies and are listed by MedlinePlus. An RDA is the daily intake that meets the needs of nearly all healthy people.

GroupRDA per day
Men 19–30400 mg
Men 31 and over420 mg
Women 19–30310 mg
Women 31 and over320 mg
Pregnancy, 19–30350 mg
Pregnancy, 31–50360 mg

The NHS advises that a varied, balanced diet should give you all the magnesium you need.

Can you have too much magnesium?

From food, it is unlikely. MedlinePlus explains that the body usually removes the extra, so high intake rarely causes problems "except in people with significantly reduced kidney function." When excess does happen, it usually comes from supplements or from laxatives that contain magnesium.

Supplements and medicines are a different matter. NCCIH says magnesium from these sources should not go above the upper limit, which is 350 mg a day for adults, unless a health care provider recommends it. The upper limit is a safety ceiling, not a target. High intakes from supplements and medicines can cause:

  • Diarrhea
  • Nausea
  • Abdominal cramping

NCCIH adds that "Extremely high intakes of magnesium can lead to irregular heartbeat and cardiac arrest".

Who should be careful with magnesium supplements?

Supplements are regulated differently from medicines, as explained in how supplements are actually regulated. Check with a doctor or pharmacist before trying one if any of these apply:

  • You have kidney disease or have been told your kidney function is reduced. The kidneys normally clear extra magnesium, and MedlinePlus singles out significantly reduced kidney function as the situation where high intake causes problems.
  • You take regular medicines. An NCCIH fact sheet warns that "Magnesium can interact with medicines, including some antibiotics, diuretics, and drugs used to treat osteoporosis." Which herbs interact with medication explains why a pharmacist check matters for supplements in general.
  • You already use a laxative or other product that contains magnesium, because it adds to the total from supplements.
  • You are pregnant or breastfeeding, or the supplement is for a child. NCCIH says it is especially important to consult a health care provider in these situations.

If you notice side effects after starting any supplement, stop taking it and contact your doctor. If you notice an irregular heartbeat, get medical help straight away.

Do sleep habits matter more than supplements?

For most people, yes. The NHS insomnia guide says insomnia "usually gets better by changing your sleeping habits." Its suggestions include going to bed only when you are sleepy, getting up at the same time every day, relaxing for at least an hour before bed, keeping the bedroom dark and quiet, and avoiding alcohol, tea and coffee for at least 6 hours before bed. The sleep hygiene checklist sets out these habits in one place.

When insomnia becomes long-term, the strongest evidence is for a structured therapy rather than a pill or a supplement. The American College of Physicians guideline recommends cognitive behavioral therapy for insomnia (CBT-I) as the initial treatment for chronic insomnia disorder in adults, a strong recommendation based on moderate-quality evidence. NCCIH likewise describes multicomponent CBT-I as the treatment most strongly recommended for insomnia.

When should you talk to a doctor about poor sleep?

The NHS suggests seeing a GP if:

  • changing your sleeping habits has not helped
  • you have had trouble sleeping for months
  • your insomnia is affecting your daily life so much that you are struggling to cope

A doctor can look for what is behind your sleep problem so it can be treated properly. Common causes of insomnia explains what often lies behind it, and it is worth mentioning any supplements you take at the appointment.

For a practical next step, see how long caffeine affects sleep. The full guide to better sleep covers how much sleep you need and what to do when it goes wrong.