What magnesium does
Magnesium is a mineral your body needs for muscles, nerves, energy production and bone health. It plays a part in signalling systems in the brain that relate to relaxation. The National Institutes of Health fact sheet explains that most people get it from food and that low intake is common in some groups.
Because it is linked to relaxation, magnesium has become a popular idea for sleep. Popularity is not the same as proof.
What research says
Mah and Pitre pooled studies of oral magnesium in older adults with insomnia. They found some signs of benefit for how quickly people fell asleep and for sleep time, but the studies were small and the certainty of evidence was low. Most trials were short, used different doses and measured sleep in different ways.
That means magnesium might help some people, we do not know who, and we do not have good long term safety data for sleep use. Treat claims from sellers with caution.
Getting magnesium from food
- Pumpkin seeds, almonds, cashews and peanuts
- Spinach and other leafy greens
- Black beans, lentils and chickpeas
- Whole grains such as oats and brown rice
- Fish such as salmon
- Dark chocolate in small amounts
Supplements and safety
Supplements come in many forms, and products differ in how much they contain. Too much from supplements can cause loose stools, nausea and cramps. People with kidney disease are at higher risk of buildup. Magnesium can also interact with some antibiotics, bisphosphonates and other medicines.
This page does not recommend a dose. Speak to a doctor or pharmacist before you try a supplement, especially if you are pregnant, take medicines or have a health condition.
What helps sleep more reliably
The best evidence supports habits such as a steady schedule, morning light, limiting caffeine and alcohol, and CBT for insomnia (Trauer and colleagues, 2015). Treat supplements as an optional extra, not a first step.
If you have trouble sleeping, the sleep latency scorer and what to eat for better sleep are good places to start.
How to read a magnesium sleep claim
- Check who ran the study and who paid for it.
- Look at the number of people and how long it lasted.
- See whether sleep was measured with a device or a questionnaire.
- Check if the study was in people like you.
- Look for side effects and safety notes.
- Ask your clinician before buying.
This page is general education and not medical advice. If you have ongoing sleep problems, loud snoring, breathing pauses or severe daytime sleepiness, speak to a doctor.
Who might be more likely to have low magnesium?
Surveys show that many adults eat less magnesium than recommended. People with digestive diseases, long term heavy alcohol use, type 2 diabetes or those taking some medicines such as certain diuretics and acid reducers can lose more or absorb less. A doctor can check this if there is a reason to suspect it.
If your diet is low in nuts, seeds, greens and whole grains, adding those foods is a safe first step that also helps general health.
Magnesium for cramps, stress and restless legs
Magnesium is also discussed for night cramps, restless legs and stress. Evidence for each is mixed, and results from trials often do not match the claims. If you have leg symptoms that wake you, tell your doctor, since iron levels, medicines and other conditions can be involved.
A warm bath, gentle stretching and a regular evening routine are low risk ways to ease tension without a pill.
Questions to ask your doctor or pharmacist
- Is a supplement safe with my medicines and conditions?
- Could my symptoms have another cause, such as restless legs or low iron?
- Would food changes be enough?
- How long should I try it before stopping?
- What side effects should make me stop?
Bring the product label so the professional can check the form and amount.
Frequently Asked Questions
Does magnesium help you sleep? ›
Evidence is limited and low in certainty, so it is not a proven sleep aid.
What foods are high in magnesium? ›
Nuts, seeds, leafy greens, beans and whole grains.
Can magnesium cause side effects? ›
Yes, such as diarrhoea and cramps, and it can interact with some medicines.
Is magnesium safe in pregnancy? ›
Ask your doctor or midwife before using any supplement.
What is the best form? ›
There is no proven best form for sleep. Ask a pharmacist.
What else should I try first? ›
A steady schedule, daylight, less caffeine and CBT for insomnia.
Written by F.A and last updated on 5 November 2026. Claims are checked against the peer reviewed papers and public health sources listed below, and findings from small or early studies are labelled as such. We follow our editorial policy and explain how times and results are calculated in our methodology. Calculators run in your browser and store nothing. Found an error? Tell us and we will correct it.
Sources
- Mah J, Pitre T. Oral magnesium supplementation for insomnia in older adults: a systematic review and meta analysis. BMC Complement Med Ther 2021
- National Institutes of Health Office of Dietary Supplements. Magnesium fact sheet for health professionals
- Trauer JM et al. Cognitive behavioral therapy for chronic insomnia: a systematic review and meta analysis. Ann Intern Med 2015
- Hirshkowitz M et al. National Sleep Foundation's sleep time duration recommendations. Sleep Health 2015
This page gives general information for adults and is not medical advice. If you have ongoing sleep problems, loud snoring, breathing pauses or heavy daytime sleepiness, speak to a doctor. Times and results are estimates.
