A magnesium blood test measures the amount of magnesium in a sample of your blood. Magnesium is a mineral that you get from many kinds of foods you eat. Some examples include nuts, seeds, beans, fortified breakfast cereals, green leafy vegetables, and milk.
Your body needs magnesium to help your muscles, nerves, and heart work properly. Magnesium also helps control blood pressure and blood glucose, also called blood sugar. It's important for building strong bones, and it supports your immune system.
Magnesium is a type of electrolyte. Electrolytes are electrically charged minerals. They help control the amount of fluid and the balance of acids and bases (pH balance) in your body.
Most of your body's magnesium is stored in your bones, organs, and other body tissue. Only a small amount is found in your blood.