Magnesium

Nutrients & plant compounds

Compare this topic

Short answer

Magnesium helps muscles move, nerves send messages and the body use energy from food. Whole grains, beans and nuts supply it. Supplements may help reduce how often migraine attacks happen, but only with a clinician's supervision because of the amounts studied. Small, poor-quality studies suggest a possible sleep benefit; ordinary night cramps in older adults probably do not improve noticeably. [2][3][4][5]

Magnesium helps muscles move, nerves pass signals and the body use energy from food.

Checked against sources; not clinician-reviewed. Not personal medical advice. Read the disclaimer

Updated: 2026-10-08

What does your body use magnesium for?

  • Movement. Muscles need magnesium for normal contraction and relaxation. A cramp is not proof of deficiency. [1] [3]
  • Nerve messages. Magnesium plays a part when nerves tell muscles when to move. [1]
  • Energy and bones. It helps the body use energy from food and maintain bones. More than you need does not automatically mean more energy. [1] [2]
  • Migraine and sleep. Supplements may help people have fewer migraine attacks; the evidence for falling asleep faster is much weaker. Magnesium's normal role in the body does not prove either effect. [4] [5]

Where can you get magnesium?

Wholegrain bread, oats, beans, lentils, nuts, seeds and leafy greens supply magnesium. Dairy, meat and drinking water contribute too. A varied everyday diet is a useful starting point; magnesium in food does not need restricting. [2]

How much dietary magnesium do you need?

The Dutch daily food guideline is 350 mg for adult men and 300 mg for adult women. The value for women stays at 300 mg during pregnancy and breastfeeding. These are not supplement doses: eating less on one day does not automatically mean you have a deficiency. Different values apply to children. [2]

Do supplements help with cramps?

Magnesium tablets probably do not noticeably prevent ordinary night cramps in older adults. Pregnancy studies disagree; suitable trials for exercise cramps were lacking. This does not test treatment of a confirmed shortage. [3]

For migraine, a review of five small studies found a possible reduction in how often attacks happen, not a way to stop an attack already underway. Use magnesium for this only under clinician supervision: amounts studied exceed ordinary supplement safety limits and can cause side effects or interact with medicines. This is not dosing advice. [4]

People also use magnesium for sleep. A small review in older adults with insomnia suggested they might fall asleep faster, but the studies were poor quality and other research was mixed. It is not a proven general sleep aid. [5]

A cramp alone does not prove a deficiency. Long-lasting diarrhoea, poor absorption, diabetes or some medicines may merit assessment. A blood test can help, but does not show all the body's stores. Discuss lasting symptoms and medicines with a clinician rather than using pills as a home test. [1] [2]

When can magnesium pills be risky?

Magnesium from food is generally safe for healthy people. Supplements and magnesium-containing medicines can cause diarrhoea, nausea and stomach cramps. Dutch guidance sets 250 mg a day as the upper limit for extra magnesium from supplements; this does not include magnesium in food. [2]

With reduced kidney function, magnesium can build up. Some medicines, such as water tablets and acid-suppressing drugs, may affect magnesium levels. Ask a clinician or pharmacist about kidney disease or medicines, and do not stop prescribed treatment yourself. [1]

Frequently asked questions

Does magnesium help with cramps, migraine or sleep?

Tablets probably do not noticeably prevent ordinary night cramps in older adults; pregnancy results are uncertain. Supplements may reduce how often migraine attacks occur, but do not stop an ongoing attack. Use them for migraine only under clinician supervision: studied amounts exceed ordinary safety limits. Small, weak studies in older adults with insomnia suggest they might fall asleep faster, but magnesium is not a proven general sleep aid. [3][4][5]

Which foods contain magnesium?

Whole grains, legumes, nuts, seeds, and leafy vegetables are useful sources. Some dairy foods, meat, and water also contribute.[2]

Is the recommended intake the same as the supplement limit?

No. The Dutch daily food guideline is 350 mg for adult men and 300 mg for adult women, including during pregnancy and breastfeeding. The 250 mg/day upper limit concerns extra magnesium from ordinary supplements, not food. Migraine supplementation needs a clinician's supervision; do not choose a higher amount yourself. [2][4]

Can a blood test find deficiency?

A low blood result can be important. A normal one does not entirely exclude low stores; clinicians weigh symptoms, illnesses and medicines too. That is not a reason to assume every symptom hides deficiency. [1]

Are magnesium supplements safe with kidney disease?

Do not assume so. Reduced kidney function can impair magnesium excretion and allow it to build up. Ask a clinician or pharmacist before using supplements or magnesium-containing medicines.[1]

Research and sourcesEvidence overview, methods and complete source list

What has been studied?

Magnesium in food supports muscles and nerves; supplements may reduce migraine frequency. Evidence that it helps people fall asleep faster is weak.

Finding: Magnesium tablets probably do not noticeably prevent ordinary cramps in older adults. Pregnancy results are uncertain; treating diagnosed deficiency is a different question.

Nocturnal cramps in older adults

Evidence: Systematic review of trials; direct evidence for the stated endpoint, limited by its population and study variation.

Studied population: Older adults with ordinary cramps; pregnancy evidence separate.

Form or context: Magnesium supplements for cramp prevention, not food or deficiency replacement.

Uncertainty: Not a trial of confirmed deficiency; pregnancy evidence conflicts.

Sources: Magnesium for skeletal muscle cramps

Finding: Supplements may reduce how often migraine attacks occur, but do not stop an ongoing attack; use only with clinician supervision.

Fewer migraine attacks

Evidence: NCCIH reports a 2018 review of five studies with 253 participants; three showed benefit.

Studied population: Participants in five migraine prevention studies, not everyone with headaches.

Form or context: Studied magnesium supplements for prevention, not food or acute treatment.

Uncertainty: Few small studies; studied amounts exceed ordinary supplement safety limits and may cause side effects or medicine interactions.

Sources: Headaches: What You Need To Know

Finding: A few small studies in older adults with insomnia suggest they might fall asleep faster; the evidence is too weak for general sleep advice.

Falling asleep faster with insomnia

Evidence: NCCIH discusses a 2021 review of three studies (151 participants) and conflicting findings from a larger review.

Studied population: Older adults with insomnia in the small review, not everyone with sleep difficulties.

Form or context: Magnesium supplements; no established product or dose recommendation.

Uncertainty: Low-quality studies, with mixed findings from other sleep research.

Sources: In the News: Magnesium Supplements for Sleep Disorders

Safety: A cramp alone does not diagnose deficiency. Supplemental magnesium can cause diarrhoea; Dutch guidance sets 250 mg/day as the upper limit for extra magnesium, not magnesium in food. Kidney disease and interacting medicines require professional advice. Use for migraine only under clinician supervision: studied amounts exceed ordinary supplement safety limits.

Sources

  1. Magnesium Blood Test · MedlinePlus Medical Test, US National Library of Medicine · Public health information
  2. Magnesium · Voedingscentrum · Institutional information
  3. Magnesium for skeletal muscle cramps · Cochrane · 2020 · Systematic review
  4. Headaches: What You Need To Know · NIH National Center for Complementary and Integrative Health · Public health information
  5. In the News: Magnesium Supplements for Sleep Disorders · NIH National Center for Complementary and Integrative Health · 2024 · Public health information