It feels like everyone is talking about magnesium supplements — from influencers touting better sleep, to friends who swear it helps with digestion. But with so many types on the market, it can be hard to know which one, if any, is right for you.

 “Some of them have a lot of good research and track records behind them in terms of usefulness in health and wellness,” Dr. Sarah Kidder, a family medicine physician at Endeavor Health Medical Group in Woodridge, Illinois, says about the different bottles of magnesium lining store shelves. “And some less so.”

Magnesium — a mineral that is naturally present in many foods, such as green leafy vegetables and whole grains — supports several critical functions in the body. It helps regulate muscle and nerve function and is involved in protein and DNA production.

How much magnesium do I need?

It’s recommended that men get between 400 and 420 milligrams (mg) of magnesium daily, and that women aim for 310 to 320 mg daily.

Too much magnesium can cause some health problems, including:

DiarrheaNauseaAbdominal crampingVery low blood pressureLethargyImpaired kidney functionWeakness

Source: Cleveland Clinic

Most Americans eat enough magnesium and won’t experience a true deficiency. (Low levels are common in people with malnutrition, says Nicole Roach, a registered dietitian at Lenox Hill Hospital in New York. Alcoholism, chronic kidney disease, type 2 diabetes or inflammatory bowel diseases, such as Crohn’s and ulcerative colitis, can also put you at higher risk for having a magnesium deficiency, Kidder says.)

Even still, some people who have certain health issues, such as long-term constipation, migraines, poor sleep and muscle aches, may benefit from a magnesium supplement, though it’s important to talk to a doctor or pharmacist before taking any supplement, since supplements can cause side effects and interact with other medications you may be taking.

“Some medications will, unfortunately, require us to totally stay away from a magnesium supplement,” says Roach. “[Magnesium] can lower the absorption of specific antibiotics, different medications that are used for osteoporosis, which is a bone disease, and then different antiviral medications.”

It’s also important to discuss the dose with an expert because too much magnesium can lead to an uncomfortable problem. “The most common side effect from magnesium — even at normal doses, but certainly as you increase the dose — is diarrhea,” Kidder explains. “You can get significant diarrhea and GI [gastrointestinal] upset.”

There are several types of magnesium supplements on store shelves, and they’re not all used for the same purpose. Many are paired with another compound, and that pairing can affect how the supplement is absorbed, tolerated and used in the body.

Here’s what experts want you to know about seven popular types of magnesium.