Why Magnesium Helps with Sleep (and How to Get It)

Add this important mineral into your daily routine for more restful nights.

Products containing magnesium: bananas, pumpkin seeds, blue poppy seed, cashew nuts, beans, almonds, sunflower seeds, oatmeal, buckwheat, peanuts, pistachios, dark chocolate and sesame seeds on wooden table.
Getty Images

There are many complicated paths toward sleeping better and getting more sleep. Luckily, one potentially effective tool is simple and relatively easy to access: magnesium.

This important mineral, which is present in many foods and commonly available as a supplement, plays many roles in the body, including helping to regulate blood pressure and blood sugar, build bones, steady the heartbeat, manage hydration, and more.

Research suggests that it may help with falling asleep, sleep quality, and even sleeping through the night.

“I typically will use magnesium as a first-line treatment to help with sleep,” says integrative physician Dr. Sonya Chawla, noting that this comes after looking at lifestyle factors.

“The first thing is to evaluate any modifiable factors — medications, personal sleep hygiene, partner habits that can be adjusted,” Chawla says. “Always try to treat the underlying condition, which is not easy. Even if certain habits are adjusted, patients may still have difficulty either initiating or maintaining sleep.” That’s when magnesium joins the chat.

How does magnesium help sleep?

Though it’s not fully understood, there are three significant ways in which magnesium may benefit sleep.

For one, magnesium helps the body maintain optimal levels of the neurotransmitter gamma-aminobutyric acid (GABA), which promotes sleep. In a small study, magnesium supplements helped elderly participants with insomnia by boosting sleep time and quality.

Anxiety and depression can also interrupt sleep; research indicates that magnesium can help. “Magnesium serves as a relaxant, calming the nerves all over,” Chawla says. It helps regulate the release of the stress hormone cortisol. Plus, magnesium’s role in regulating GABA and other neurotransmitters also helps with mood and, by extension, sleep.

Another issue that can disturb sleep: muscle cramps. “Muscle cramps at night are one of the most common complaints of my patients,” Chawla notes; in fact, up to 60% of adults report suffering from leg cramps at night. Some research suggests that magnesium may help relieve nighttime leg cramps and improve sleep.

How can you get magnesium?

Luckily, you can find this important mineral in many healthy foods — likely some that you’re already eating. It’s abundant in nuts and seeds, legumes like black beans and edamame, and animal proteins like chicken and beef. If you’re a fellow chocolate lover, you’re in luck: Dark chocolate is an excellent source of magnesium.

However, modern farming practices and climate change have affected the amount of magnesium in the soil and its bioavailability, so although it’s a good idea to eat foods rich in the mineral, supplementing can help ensure that you’re getting enough.

If you’ve shopped for magnesium supplements at your local pharmacy, you may have noticed that there are a few different types, and they’re not all created equal. “The form of magnesium I prefer is magnesium glycinate,” Chawla says. “There is some evidence that glycine itself is helpful for treating insomnia. The glycinate also aids in the body’s absorption of magnesium in the bloodstream.”

Another common type, magnesium citrate, is more useful for treating constipation, Chawla adds.

To help with sleep, “I typically start around 250 mg and increase to 500 mg, to be taken 1 hour prior to bedtime,” she says, noting that healthy patients generally don’t need to worry about taking too much. “The body is amazing at regulating magnesium. If you get too much, the kidneys will take care of it. You’ll excrete what you don’t need.” Magnesium is popular as an alternative to other sleep aids, many of which have not been sufficiently tested for doctors to know side effects and long-term health effects.

To get the best sleep benefits from magnesium, try pairing the mineral with good sleep hygiene:

  • Stick to a consistent sleep and wake-up schedule. 
  • Limit your use of screens an hour before going to bed. 
  • Dim your lights at night. 
  • Keep your sleep environment quiet, calming, and cool.