Home / How Magnesium Can Help You Sleep

How Magnesium Can Help You Sleep

Jay Summer

Written by

Jay Summer, Staff Writer

Heather Wright

Medically Reviewed by

Heather Wright, Pathologist

Fact Checked Icon
Fact Checked

Our team of writers, editors, and medical experts rigorously evaluates each article to ensure the information is accurate and exclusively cites reputable sources. Learn More

Recency Statement Icon

We regularly assess how the content in this article aligns with current scientific literature and expert recommendations in order to provide the most up-to-date research.

Magnesium is a relatively new treatment recommendation for better sleep. This nutrient plays a large role in sleep regulation. Current research shows that additional magnesium can help the body relax and even improve symptoms of insomnia.

If you are interested in using magnesium as a natural sleep aid, talk to your doctor about whether it might work for you.

What is Magnesium?

Magnesium is a nutrient essential for more than 300 processes in your body. Magnesium maintains a healthy immune system, regulates muscle and nerve function, ensures a steady blood pressure, and keeps your bones strong. Magnesium also helps manage blood sugar levels and is needed for protein and energy production.

Health experts recommend adults take in 300 to 420 milligrams of magnesium daily. The appropriate amount depends on your sex, age, and whether you are pregnant or breastfeeding. Without magnesium supplements, as many as 48% of Americans do not get enough daily magnesium.

Certain groups are at higher risk for insufficient magnesium levels:

  • Older adults
  • Teenagers
  • People with Type 2 diabetes
  • People who drink excessive amounts of alcohol
  • People with gastrointestinal disorders

Foods with Magnesium

You can find magnesium naturally in many foods, including:

  • Leafy green vegetables, such as spinach or swiss chard
  • Nuts, legumes, and seeds, including cashews, almonds, peas, and beans
  • Yogurt and milk
  • Tofu, soy milk, and other soy products
  • Whole grains, like brown rice

You can also find magnesium in fortified foods. Many breakfast cereals have added magnesium.

Chart of foods containing higher magnesium content

Chart of foods containing higher magnesium content

How Magnesium Impacts Sleep

Additional magnesium in your diet has the potential to help you sleep better. While researchers recognize that magnesium plays an important role in sleep regulation, they do not fully understand the effect of magnesium on sleep behaviors.

“What’s clear from the research is that a lack of magnesium negatively impacts sleep.”

What’s clear from the research is that a lack of magnesium negatively impacts sleep. A serious shortage of magnesium in the body is rare. However, some of the signs of insufficient magnesium in your diet are muscle weakness and tiredness. Low levels of magnesium are associated with poor sleep quality and insomnia. Anxiety and depression also correlate with low magnesium levels, and both anxiety and depression can contribute to insomnia.

Magnesium and Insomnia

Insomnia is a common sleep disorder where you have difficulty falling asleep, staying asleep, or both. People with insomnia experience a lack of energy and don’t feel refreshed in the morning. They may also struggle with excessive daytime sleepiness, irritability, anxiety, or depression.

Research shows that magnesium may help improve insomnia symptoms. In a study of elderly patients with insomnia, taking 500 mg of magnesium daily for eight weeks improved many subjective and objective measures of insomnia. The patients:

  • Fell asleep faster and slept longer
  • Increased their sleep efficiency, meaning they spent more time sleeping while they were in bed
  • Woke up later and reduced early morning awakening
  • Experienced increased concentrations of melatonin, a sleep hormone, and serum renin which plays a role in regulating blood pressure
  • Experienced decreased concentrations of serum cortisol, the “stress hormone”

Other studies have produced similar results. Patients given a combination supplement of magnesium, melatonin, and vitamin B for three months also experienced significant benefits in the management of their insomnia. The combination reduced insomnia symptoms and side effects, leading to a better quality of life.

Magnesium and Restless Leg Syndrome

People with restless leg syndrome (RLS) experience uncontrollable urges to move the limbs and sometimes cramping or crawling sensations, often peaking in the evening hours when at rest. The sensation makes falling asleep difficult and can wake you out of your sleep.

Research shows mixed results when using magnesium to treat patients with RLS. One small study found that sleep efficiency increased significantly, from 75% to 85%, when RLS patients took magnesium for 4 to 6 weeks. Other studies have shown that magnesium salts may reduce leg cramps during pregnancy.

In contrast, a study  of magnesium as a treatment for nocturnal leg cramps in older adults showed no significant change in symptoms. More research needs to be done to determine who can benefit from magnesium as treatment for RLS, and therefore improve their sleep.


Other Benefits of Magnesium

In addition to improving sleep, magnesium supplements can be used to treat other health conditions:

  • Osteoporosis: Magnesium is a component of the bone-building process. Preliminary research shows that magnesium supplements can reduce bone loss caused by osteoporosis.
  • Cardiovascular Disease and Hypertension: Research shows that magnesium may reduce the risk of stroke or heart disease. However, participants in these studies were given a variety of nutrients, so the results can’t be attributed to magnesium alone. Additionally, research shows magnesium can reduce blood pressure, but only minimally.
  • Type 2 Diabetes: Because magnesium plays a role in the breakdown of sugars in the body, if you have a high amount of magnesium in your diet, you’re less likely to develop type 2 diabetes. Researchers currently  have insufficient evidence to prove that magnesium is effective in managing type 2 diabetes if you already have the disease.
  • Migraines or Migraine Headaches: People with low levels of magnesium are more prone to experiencing headaches or migraines. Limited studies have shown that magnesium can reduce the frequency and duration of migraine headaches. The American Academy of Neurology and the American Headache Society have determined that magnesium is “probably effective” as a migraine treatment and could be considered a possible preventative measure. However, because the effective level of magnesium for migraine treatment is higher than the standard upper limit, you should only take magnesium for migraines with the guidance of your healthcare provider.

Risks of Magnesium

Magnesium supplements, when taken in appropriate doses, pose few risks. The  kidneys of healthy individuals can eliminate any extra magnesium in the urine. If you take high-dose magnesium medications or dietary supplements, you may experience:

  • Diarrhea
  • Cramping
  • Nausea

In addition, extremely high intakes of magnesium can lead to an irregular heartbeat.  Taking magnesium with food can reduce the likelihood of these symptoms.

Magnesium can also interact with certain medications. Consult your doctor and review your current medications with them before starting magnesium supplements.

Magnesium Vs. Melatonin

Magnesium and melatonin have different functions in your body. Magnesium is a nutrient that regulates different body processes, while melatonin is a hormone that regulates sleep patterns.

The supplement you should take ultimately depends on your goals for sleep. Magnesium helps the body relax. This nutrient reduces stress and helps you sleep longer. In contrast, melatonin helps you get to sleep faster. Both magnesium and melatonin can be  used to treat insomnia, sometimes even in combination.

Always consult with your healthcare provider to determine which supplement is right for you.

How to Use Magnesium for Sleep

Before starting magnesium supplements, focus on getting the proper amount of nutrients in your diet. According to the American Dietary Guidelines for 2020-2025, you should meet most of your nutritional needs by consuming nutrient-dense food and beverages. This includes vegetables, whole fruits, grains and whole grains, dairy, and protein foods.

If you are still having difficulty sleeping, consult your healthcare provider. You want to verify there are no underlying sleep disorders or other concerns affecting your sleep. Then you can talk to your doctor about additional magnesium supplements. Be sure to talk about your current medications, as you want to ensure the magnesium will not interfere with other medications.

While you can take magnesium in the hours before bedtime, as is recommended for melatonin, you can alternatively take magnesium supplements during the day. The time you take magnesium often depends on any other medications you are taking. For example, you should take antibiotics either 2 hours before or 4 to 6 hours after taking magnesium. Consult your healthcare provider to determine what type of magnesium supplement you should take and what time you should take it to improve your sleep.

  • Was this article helpful?
  • YesNo

About Our Editorial Team

Jay Summer

Staff Writer

Jay Summer is a health content writer and editor. She holds a B.S. in psychology and master's degrees in writing and public policy.

Heather Wright



Dr. Wright, M.D., is an Anatomic and Clinical Pathologist with a focus on hematopathology. She has a decade of experience in the study of disease.


+14  Sources