You may not be as familiar with magnesium as you are with better-known minerals such as iron, calcium, and zinc, but magnesium is incredibly important for many of the body’s functions. It plays a key role in your immune system, nerves, and muscles, and helps keep your heart and bones strong. In all, magnesium is involved in more than 300 of the body’s biochemical reactions. But important as magnesium may be for keeping you healthy, the U.S. Department of Agriculture dietary surveys show that about half of all Americans are taking in less of it then they should. Here is what you need to know about magnesium deficiency, including symptoms, causes, and risk factors. Plus, how to add more magnesium-rich foods to your diet.

How common is magnesium deficiency?

It’s important to note that while many people aren’t getting enough magnesium through diet alone, it’s rare to have a true deficiency. You have your kidneys to thank for this; they limit how much of the mineral is expelled through your urine. So, if you’re otherwise healthy, chances are you don’t have a magnesium deficiency. That said, chronic alcoholism, certain medications, and a habitually low intake of the mineral can lead to a true magnesium deficiency.

What’s much more common is magnesium inadequacy. A magnesium inadequacy occurs when someone is taking in less than their recommended daily allowance of the mineral, but levels are above the threshold for a deficiency. Some groups are more at-risk than others for developing magnesium inadequacy.

Who’s at risk for low magnesium?

Chronic medical conditions are often the culprit. Some doctors say that people at highest risk for low magnesium are those with diarrhea and other forms of malabsorption. People with type 2 diabetes are also more likely to be low on magnesium because insulin resistance can increase urination frequency, and thus urinary excretion of the mineral. Older adults also tend to have lower magnesium levels than younger people. This is in part because they are more likely to have developed chronic disease or be taking medications that could mess with magnesium levels, but also because magnesium absorption from the gut decreases as we age.

An actual magnesium deficiency is common in people who chronically abuse alcohol. The increased likelihood of having a poor diet, gastrointestinal problems related to pancreatitis, renal dysfunction, vitamin D deficiency, and other factors all play a role.

Magnesium deficiency symptoms

First of all, remember: magnesium deficiency is very rare. If you are simply low on magnesium, you probably won’t experience any of the following symptoms.

The earliest signs of magnesium deficiency include nausea, general fatigue, and a loss of appetite. In more advanced cases, someone with magnesium deficiency could experience heart problems (including irregular heart rhythm), muscle cramping and spasms, weakness, trouble sleeping, seizures, and tremors. A magnesium deficiency could also cause poor memory or even anxiety.

Another possible byproduct of magnesium deficiency is an electrolyte deficiency. Doctors believe that magnesium maintains a balance of other electrolytes, such as sodium, potassium, and calcium. In turn, these electrolytes support nerve conduction, muscle contraction and maintain normal heart rhythm. A blood test in your primary care doctor’s office can help assess whether or not you have an electrolyte deficiency.

Do you need a magnesium supplement?

Probably not. Roshini Rajapaksa, MD, states that being low on magnesium is a concern, since it’s so essential for your heart, muscles, immune system, and more, but you shouldn’t reach for a supplement without first consulting your doctor.  She says, “Unless you have a gastrointestinal disorder, like Crohn’s or celiac disease, or you take certain medications, like diuretics, chances are you don’t need to supplement your intake.”

What to know about excessive Magnesium

While it’s unlikely that you’d overdo magnesium through diet alone, there is such a thing as too much of the mineral when you’re taking supplements. Excessive magnesium intake can result in diarrhea, nausea, abdominal cramping, and possibly even arrhythmia (abnormal heart rhythm). Magnesium can also interact with some medications, such as antibiotics, certain blood pressure medications, diabetes medications, and diuretics.  Dr. Levine says, “It is always best to consult with your primary care physician if you are experiencing symptoms of low magnesium. They can do a thorough review of your medications, as well as your medical history. Since magnesium deficiency is uncommon, it’s possible your symptoms are being caused by something else.”

Magnesium and diet

A safer option than heading straight to the supplement aisle? Fill your plate with plenty of magnesium-rich foods. The Food and Nutrition Board at the Institute of Medicine and National Academies recommends that women ages 19 to 30 aim for 310 mg of magnesium a day (that number goes up if you’re pregnant or lactating), and slightly more for women ages 31 to 50. Dark, leafy greens, seeds, and nuts are some of the best sources of magnesium. Opt for almonds, sesame seeds, cashews, pumpkin seeds, and flaxseed. Other magnesium-rich foods include tofu, bananas, and black beans.