
If you have heard people talking about magnesium as a sleep aid, there is actually something to it. Research published in Nature and Science of Sleep suggests that magnesium helps calm the nervous system and supports muscle relaxation. It may also help keep your body’s internal clock on track.
But here is the thing most people do not think about: when you take it matters just as much as whether you take it.
The Sweet Spot for Timing
Dr. W. Christopher Winter, MD, a neurologist and sleep medicine physician with Charlottesville Neurology and Sleep Medicine, has a clear recommendation. “Take magnesium one to two hours before bed to capitalize on the calming effects and not create gastrointestinal issues right before bedtime, which can happen in some people,” he says.
Some people can take it as close as 30 minutes before turning in, according to Keri Gans, RDN, CDN, a nutrition consultant. But she suggests paying attention to how your stomach feels after taking it, since everyone is a little different.
Gans also points out that pairing magnesium with a consistent bedtime routine may be more effective than relying on the supplement alone.
Why Magnesium Helps You Sleep
Magnesium works on sleep in a few different ways. Sonya Angelone, PhD, RDN, a registered dietitian based in San Francisco, explains that magnesium is a smooth muscle relaxant that helps calm the nervous system.
Dr. Winter adds that magnesium helps your body maintain healthy levels of GABA, a neurotransmitter that promotes feelings of sleepiness. Dr. Angelone notes that magnesium also supports the body’s natural production of melatonin, the hormone that signals it is time to sleep.
Put it all together, and magnesium, as Dr. Winter puts it, “plays a big role in sleep onset and maintenance.”
How Much Do You Need Each Day?
The recommended daily intake varies based on your sex and health situation. Generally speaking, adult men should aim for 400 to 420 milligrams of magnesium per day, according to the National Institutes of Health. Adult women should aim for 310 to 400 milligrams daily.
Here is a sobering fact: Dr. Winter notes that about 50 percent of the population does not meet its daily recommended magnesium intake. He calls this a “subclinical deficiency”, meaning it does not necessarily point to a medical problem, but it is worth discussing with your doctor.

Which Type of Magnesium Is Best for Sleep?
Not all magnesium supplements are the same. Different forms affect the body in different ways. For sleep specifically, both Dr. Winter and Gans recommend magnesium glycinate.
“I recommend glycinate if sleep improvement is the goal,” Dr. Winter says. Gans agrees, noting that it tends to be well-tolerated and less likely to cause digestive issues than other forms.
Other common forms, magnesium oxide, magnesium hydroxide, and magnesium citrate, are more often used to ease constipation, so they are not the best choice if sleep is your main concern.
Dr. Winter also advises buying from reputable brands to make sure you are getting what the label says.
A Few Other Sleep Tips Worth Keeping

Magnesium can be a helpful piece of the puzzle. But Dr. Winter recommends keeping these habits in mind, too:
- Stick to a fairly regular sleep schedule
- Exercise daily
- Practice some form of mindfulness or stress reduction each day
- Get outside often
- Keep your bedroom comfortable and tidy
Good sleep rarely comes from one thing alone. But if magnesium is part of a solid routine, taken at the right time and in the right form, it just might help you get the rest you deserve.
