What Is It? Magnesium is a mineral your body needs to work right. It helps with hundreds of important body processes, including those that control how your muscles and nerves work. It helps to keep your bones strong, heart healthy, and blood sugar normal. It also plays a role in your energy level. You can get magnesium in many foods and drinks. But if your doctor thinks you need more, s/he may suggest that you add supplements.

How Much Do You Need? An adult woman needs about 310 milligrams of magnesium a day, and 320 milligrams after age 30. Pregnant women need an extra 40 milligrams. Adult men under 31 need 400 milligrams and 420 milligrams if they’re older. Kids need anywhere from 30 to 410 milligrams, depending on their age and gender. Talk with your pediatrician about how much magnesium your child needs.

Are You Getting Enough? Almost half of Americans don’t get enough magnesium from their diet. Over time, low levels of the mineral may set the stage for a variety of health issues, including type 2 diabetes, high blood pressure, and migraines. Older adults, alcoholics, and those with type 2 diabetes or digestive issues are more likely to lack it, either because their bodies get rid of too much magnesium or they don’t take in enough in the first place.

Can You Get Too Much? If you’re healthy, your kidneys flush out the extra magnesium you get from foods. Still, too much of it can bring on cramps or nausea. If you use magnesium supplements, don’t take more than 350 milligrams a day. The same is true if you use laxatives or antacids that have magnesium. At really high doses, the mineral can make you very sick.

Benefit: Strengthens Bones Your body uses magnesium to build new bone cells. Research suggests that it may also protect against bone loss, broken bones, and the bone disease osteoporosis. Studies show that women with osteoporosis tend to have lower levels of magnesium than those who don’t.

Benefit: Fights Inflammation Inflammation is your immune system’s reaction to potential harm. In the short term, it helps your body fight off viruses and heal wounds. But if you have inflammation all the time, it can lead to health problems such as heart disease, arthritis, and diabetes. Magnesium can help keep that from happening.

Benefit: Protects the Heart Magnesium helps your heart pump blood. Right levels of the mineral can lower your chances of an irregular heartbeat, heart disease, or a heart attack. Magnesium relaxes the walls of your blood vessels, and that can help keep your blood pressure down. It also may help boost your HDL, or “good,” cholesterol levels.

Benefit: Prevents Migraines Experts think magnesium helps to block or lower pain chemicals in your brain and keeps your blood vessels from tightening. You’re more likely to get migraines if you don’t get enough. A 400- to 500-milligram supplement may help keep these headaches away

Benefit: Lowers Odds of Diabetes Magnesium helps a hormone called insulin work right. Insulin helps keep your blood sugar levels steady. In one study, people who got the most magnesium in their diet were less likely to get the disease than those who got the least.

Source: Nuts and Seeds Snack on an ounce of almonds or cashews, and you’ll get about 80 milligrams of magnesium. Other good choices include pumpkin seeds, pecans, sunflower seeds, peanuts, and flax. Sprinkle them on a salad or toss them into a trail mix. You’ll also get heart-healthy fats, fiber, and antioxidants.

Source: Whole Grains When it comes to nutrition, whole grains beat out white bread and other highly processed foods. Not only do they have lots of fiber, but they’re also high in magnesium. Two slices of whole wheat bread pack 45 milligrams of the mineral, a half-cup of brown rice has about 40 milligrams, and a half-cup of cooked oatmeal gives you 30 milligrams.

Source: Avocado Any way you slice, dice, or mash it, this is a great source of magnesium. One cup of the diced fruit holds 44 milligrams. It also serves up heart-healthy fats, fiber, and folate. Try adding avocado to your sandwich, salad, or taco.

Source: Dark Leafy Greens Here’s yet another reason to eat your veggies. You’ll get about 150 milligrams from a cup of cooked spinach or Swiss chard. Besides those two standouts, other good magnesium sources are dark leafy greens such as collard greens and kale. Bonus: They’re also loaded with calcium, potassium, iron, and vitamins A, C, and K. The vegetables don’t all have to be leafy. Okra, for example, is magnesium-rich.

Source: Soy Products Soy is a staple among vegetarians for its plant-based protein. But it’s no slouch in the magnesium department, either. A cup of soy milk rings up 60 milligrams, while a half-cup of firm tofu packs about 50 milligrams. Also check out tempeh, made with fermented soy, edamame, and soy yogurt.

Source: Beans On a given day, only 8% of Americans eat a serving of beans. That means most people are missing out on a healthy magnesium source. A half-cup of black beans has 60 milligrams and kidney beans has 35 milligrams. Other magnesium-rich legumes include chickpeas, white beans, and lentils. From stews to salads, you can add beans to nearly any dish. You’ll get an extra dose of fiber, protein, iron, and zinc.

Interactions With Medicines Talk to your doctor before you take a magnesium supplement. And make sure s/he knows everything else you take. Some drugs can make it harder for your body to absorb magnesium. And magnesium supplements can make some antibiotics and osteoporosis meds not work as well as they should.