It seems like everyone is looking for ways to get better sleep these days, and one popular strategy is taking a magnesium supplement. But will magnesium really help with shuteye, or is it just a trendy pill to take? It's smart to learn a little bit about how any supplement works — and the best way to take it — before you add it to your regimen.

Magnesium is a mineral that our bodies need in order to function — and it's been known to help us relax. It helps nerves and muscles perform do their best work and our immune system powered up. “Magnesium is important for energy production, glucose metabolism and how our DNA is actually synthesized in our body," says Dawn Jackson Blatner, R.D.N. “It supports neuron health, bone health and heart health. In fact, it's a cofactor for more than 300 different enzyme processes in the body.”

Magnesium is found in lots of healthy foods, including whole grains, nuts, beans, leafy veggies and seeds. “I tell people to eat spinach, pumpkin seeds, chia seeds, edamame, potatoes, tuna, almonds, cashews, peanuts, avocados, yogurt, oatmeal and bananas,” says Blatner.

However, 48% of Americans don’t get enough magnesium from their diets, according to the National Institutes of Health (NIH). If you’re a part of that group, you may want to ask your doctor if you should take a supplement. Read on to find out how much magnesium you should take, as well as the best time of day to take magnesium to maximize its health-boosting effects.

Our registered dietitians in the Good Housekeeping Institute Nutrition Lab review and evaluate every single supplement we recommend in accordance with our dietary supplement methodology. We then have a registered dietitian on our Medical Review Board review each article for scientific accuracy. A supplement should do just that: supplement the diet, not replace high-quality, nutritious food and important healthy lifestyle practices. Check with your healthcare provider before starting any dietary supplement regimen.

Magnesium-deficiency symptoms

The people who are most at risk of being truly deficient in magnesium are older adults, people with type 2 diabetes, those with GI diseases and people who are alcohol-dependent. According to the NIH, early signals that a person might be deficient in magnesium are a bit vague. You might experience any of these symptoms:

  • Loss of appetite
  • Lethargy
  • A feeling of weakness
  • Muscle cramps
  • Muscle weakness
  • Numbness or tingling
  • Sleep issues

What is the best time to take magnesium?

For many people, the time you take magnesium doesn't matter. “You can really take magnesium any time of day — preferably with a meal,” says Blatner. “Take it when you’re going to remember to consistently take it.”

However, there are some considerations — like your exercise routine. "Some studies suggest that taking magnesium two hours before training may reduce muscle soreness, but there’s no clear consensus on whether pre- or post-workout timing is best," says Lauren O’Connor, M.S., R.D.N., owner of NutriSavvyHealth and author of Healthy Cooking for One. Pay attention to how your own body feels after taking the supplement to decide when it might be best for your own fitness goals.

Medicines are another thing to think about in relation to magnesium. "You should always check with your doctor to determine the best timing for magnesium supplementation if you are on medications," says O'Connor. "Magnesium may interfere with certain medications, such as antibiotics. It is best to take magnesium supplementation at least 2 hours before or 4 to 6 hours after your antibiotic, as magnesium can decrease its effectiveness."

Lastly, the ideal timing may depend on what type of magnesium supplement you’re taking:

Benefits of magnesium

There's evidence that taking magnesium supplements could help with certain health conditions, though some studies were limited in scope:

  • Diabetes: A small 2014 study on patients with type 2 diabetes showed that taking 300 mg of magnesium for three months helped them control their blood sugar.
  • Migraines: Taking magnesium supplements could possibly help reduce the number of migraine headaches in people who suffer from them regularly, according to a 2018 study review.
  • Insomnia: A 2021 meta-analysis published in BMC Complementary Medicines and Therapies found there is no evidence that magnesium is effective for insomnia. However, the study also said that since supplements tend to be low-cost and widely available, it's okay to take less than 1g three times a day if you want to see if it helps you sleep.

How much magnesium to take

According to the NIH, women should consume 310 to 320 mg of magnesium per day, and men should ingest 400 to 420 mg daily. As with any nutrient you're trying to take more of, healthy foods like the ones mentioned above should always be your first choice. The good news is if you end up getting too much of the mineral from food sources, your body will pee out any extra.

Expert-Recommended Magnesium Supplements
On Sale
Magnesium Glycinate 200 mg
Nature Made Magnesium Glycinate 200 mg
Now 51% Off

On the other hand, taking too much magnesium via supplements can pose a health risk, so make sure you talk to your doctor beforehand. “The recommendation is not to exceed 350mg per day in supplement form — that’s considered the safe upper limit,” says Blatner. Keep in mind that some medications and dietary supplements, such as some antacids and laxatives, also contain magnesium, so don’t ignore that when figuring out how much to take.

Along those same lines, pay attention to how your body reacts after you ingest magnesium as some people find that any amount in supplement form can cause GI symptoms, including diarrhea and nausea.

The bottom line

When it comes to magnesium supplements, the time of day you take them matters less than taking them consistently. If you're taking any medications, consult with your doctor on the ideal timing. Otherwise, think about what benefits of magnesium you're hoping to get from it (such as less constipation, more sleep or less muscle pain) and see how your body responds when you take it at different times of day. "It's always a good idea to talk to a nutritionist about how much to take, and which type is best for your situation," says Blatner.

Headshot of Stefani Sassos, M.S., R.D.N., NASM-CPT
Medically reviewed byStefani Sassos, M.S., R.D.N., NASM-CPT
Nutrition & Fitness Lab Director

Stefani (she/her) is a registered dietitian, a NASM-certified personal trainer and the director of the Good Housekeeping Institute Nutrition and Fitness Lab, where she oversees all nutrition and fitness-related content, testing and evaluation. She holds a master’s degree in clinical nutrition from New York University, as well as advanced certifications as a Women's Fitness Specialist and a Behavior Change Specialist. Stefani is dedicated to providing readers with evidence-based content to encourage informed food choices and healthy living. She is an avid CrossFitter and a passionate home cook who loves spending time with her big fit Greek family.