When it comes to supplements, magnesium doesn’t get as much buzz as many others. But that doesn’t mean it’s not important for your body. In fact, there are plenty of magnesium benefits for women, from helping to build healthy bones to tamping down on headaches.

In case you’re not familiar with it, magnesium is an abundant mineral in your body and it’s naturally present in many foods, per the National Institutes of Health (NIH). Magnesium is required in more than 300 enzyme systems that regulate different reactions in your body, including the way your muscles and nerves function, your blood sugar control, and your blood pressure. Basically, magnesium is really important.

Despite all of that, nearly 50% of Americans have less than the recommended amounts of magnesium on a daily basis, which isn’t great.

Meet the experts: Jessica Cording, M.S., R.D., is author of The Little Book of Game-Changers: 50 Healthy Habits For Managing Stress & Anxiety; Deborah Cohen, D.C.N., is an associate professor in the department of clinical and preventive nutrition sciences at Rutgers University School of Health Professions; Scott Keatley, R.D., is co-owner of Keatley Medical Nutrition Therapy; Keri Gans, R.D.N., author of The Small Change Diet

So, what are the main benefits of magnesium and what should you do if you’re interested in taking it as a supplement? Nutritionists break it down.

Magnesium benefits

Magnesium does a lot in the body, but there are a few specific things worth noting.

It helps with blood sugar management

“Magnesium plays a role in how our body handles sugar,” says Scott Keatley, R.D., co-owner of Keatley Medical Nutrition Therapy. “It helps with the action of insulin, the hormone that controls blood sugar levels.” When you have enough magnesium in your body, insulin can work better and your body can manage blood sugar more effectively, Keatley says.

It may help with stress management

Stress can cause your body to use more magnesium than usual, which can limit your body’s ability to do other tasks with the nutrient, Keatley says. “In addition, magnesium can help reduce the release of stress hormones like cortisol,” he says. “It’s like a natural chill pill that can help keep our body’s stress response in check.”

It can help with anxiety and depression

Magnesium helps regulate your brain function and mood. “It plays a role in releasing and using neurotransmitters, which are chemicals in our brain that affect our mood and emotions,” Keatley says. “This might be why getting enough magnesium may help some people feel less anxious or sad.”

It helps maintain healthy bones

Magnesium is stored in bones and is an important part of bone health, says Deborah Cohen, D.C.N., an associate professor in the department of clinical and preventive nutrition sciences at Rutgers University School of Health Professions. “Magnesium supplements may help improve bone density and decrease fracture risk,” she says. Magnesium also helps regulate calcium and vitamin D, which are “crucial” for building strong bones, Keatley says.

It may help with headaches

Research suggests that people with a magnesium deficiency are at a greater risk for headaches and may benefit from a supplement, Cohen says. “Magnesium can affect the neurotransmitters and blood vessels in our brain,” Keatley explains. “It can help prevent the brain signals that cause migraines and can also keep blood vessels from narrowing, which is a common cause of headaches.”

It supports healthy blood pressure levels

At baseline, magnesium can help to relax and widen your blood vessels, Keatley says. “This makes it easier for blood to flow and can help lower blood pressure,” he says. “It’s like making the highways wider so that traffic can move more smoothly.” But it’s probably best to get your magnesium from food if you’re trying to lower your blood pressure, Cohen says. Research has not found that magnesium supplements have had a significant impact on lowering blood pressure—unless someone has prediabetes or insulin resistance. “Studies of individuals who consume more magnesium in foods have less high blood pressure,” Cohen says. “This may be because food sources of magnesium are also high in phytochemicals, antioxidants and fiber—substances not found in supplements.”

It may help with sleep

Cohen stresses that this is still being explored. However, some people find magnesium supplements can help their sleep, says Jessica Cording, M.S., R.D., author of The Little Book of Game-Changers: 50 Healthy Habits For Managing Stress & Anxiety. “Ninety percent of my clients struggle with sleep,” she says. “I always recommend taking magnesium before bed. It’s magic for sleep.” Why? “Magnesium helps to relax our muscles and calm our nervous system, which can help us wind down and get ready for sleep,” Keatley says. “It also plays a role in regulating the neurotransmitter GABA, which encourages relaxation and sleep.”

It may help you poop

Some types of magnesium, like magnesium citrate, can have a laxative effect, Cording says. “I recommend taking it before bed because when people wake up eight hours later, they’ll often feel ready to go,” she says. “If someone is traveling, I may suggest taking magnesium citrate to stimulate digestion.”

It could help with PMS symptoms

Research on this one has definitely been mixed. Some studies have shown that taking magnesium can tamp down on PMS symptoms like bloating and cramps, while others have found that it doesn’t make much of a difference. If you’re struggling with PMS symptoms, it’s a good idea to talk to a doctor for personalized guidance on how to help you cope. (And, if you decide together to go the magnesium route, keep in mind that 300 milligrams of magnesium stearate seems to be the most effective.)

Who should take magnesium?

If you’re considering taking a supplement, it’s important to consult a doctor or registered dietitian to see if you actually need it, Cohen says. (Your healthcare provider will check the levels of magnesium in your body with a simple blood test.)

If you are, in fact, deficient in magnesium, a supplement may be helpful. “Those at a higher risk for a deficiency include people with gastrointestinal diseases (such as inflammatory bowel disease and celiac disease), type 2 diabetes, alcoholism, and the elderly,” says Keri Gans, R.D.N., author of The Small Change Diet.

If you’re looking for help with bone strength, PMS symptoms, or to help you poop, it’s also a good idea to at least check in with your doctor before putting yourself on a magnesium supplement.

Who should not take magnesium?

There are certain medications that can interact with magnesium, making it important to talk to your prescribing doctor before starting a magnesium supplement. According to the National Institutes of Health (NIH), those medications include:

  • Bisphosphonates
  • Several classes of antibiotics
  • Diuretics
  • Proton pump inhibitors

If you’re on any of these medications, it doesn’t necessarily mean that you can’t take magnesium—you just may need to space it out a little bit. But, again, that’s a conversation to have with your doctor.

How to take magnesium

Cohen recommends keeping this in mind: “In general, less magnesium is absorbed with increasing doses, so more is not necessarily better,” she says. If you want to take a magnesium supplement, she recommends having it with food.

“Taking magnesium supplements on an empty stomach can cause diarrhea,” Cohen says.

As for the best time of day to take it, Keatley says it’s really up to you. “There isn’t a specific best time of day to take it, but some people like to take it in the evening as it can be relaxing,” he says.

Foods that are high in magnesium

There are a lot of foods that are high in magnesium, and Keatley recommends trying to get more of the nutrient in your diet from food first. These are the most magnesium-rich foods, according to the NIH:

  • Pumpkin seeds
  • Chia seeds
  • Almonds
  • Spinach
  • Cashews
  • Peanuts
  • Shredded wheat
  • Soymilk
  • Black beans
  • Edamame
  • Peanut butter
  • Potato with skin
  • Brown rice
  • Plain yogurt

Side effects of magnesium

Taking too much magnesium can lead to side effects, including diarrhea, nausea, and stomach cramps, Keatley says. “Going overboard with magnesium supplements can indeed affect other minerals in the body, like calcium and sodium,” he says. “High levels of magnesium can also lead to more serious side effects, including heart issues and kidney problems.”

How to find the right magnesium dosage

It’s recommended that adult women have 310 to 320 mg a day of magnesium and that adult men aim for 400 to 420 mg, per the NIH. (For pregnant people, that recommendation changes to 350 to 360 mg a day.)

But Keatley recommends consulting with your doctor or a registered dietitian before putting yourself on magnesium, since the right dosage depends on your age, gender, and specific needs. “They can look at your health, diet, and lifestyle to figure out the best amount for you,” he says.

Dietary supplements are products intended to supplement the diet. They are not medicines and are not intended to treat, diagnose, mitigate, prevent, or cure diseases. Be cautious about taking dietary supplements if you are pregnant or nursing. Also, be careful about giving supplements to a child, unless recommended by their healthcare provider.