What Is a Magnesium Test?

Medically Reviewed by Jabeen Begum, MD on March 26, 2024
6 min read

Magnesium is one of the major minerals your body needs to function properly. You get it from foods and supplements. It's also an ingredient in some medicines such as antacids and laxatives. More than half the magnesium you have in your body is stored in your bones and tissues. 

How is magnesium used in the body?

Magnesium does a lot to help your body work well. It's involved in almost 300 different enzyme activities. Enzymes are proteins that help speed up chemical reactions in the body. These chemical reactions help to:

  • Build proteins and strong bones
  • Regulate blood sugar
  • Maintain blood pressure
  • Digest fatty acids
  • Support muscle and nerve functions
  • Regulate the hormone cortisol to control stress 
  • Support restful sleep

Magnesium also helps balance the levels of calcium, copper, zinc, potassium, vitamin D, and other important nutrients in your body. And it aids the transport of calcium and potassium ions across cell membranes. This helps your nerves send signals, your muscles to contract, and your heart to beat in a normal, steady rhythm.

How to get more magnesium

The recommended daily amount of magnesium is 320-420 milligrams. If you eat a well-balanced diet you'll get all the magnesium you need. If you want to boost your levels, these foods are good sources:

  • Whole Brazil nuts (250 mg per 1/2 cup) 
  • Cooked spinach (157 mg per cup)
  • Pumpkin seeds (150 mg per ounce)
  • Black beans (120 mg per cup)
  • Almonds (80 mg per ounce)
  • Cashews (72 mg per ounce)
  • Dried figs (68 mg per 11 figs)
  • Dark chocolate (64 mg per ounce)
  • Avocados (58 mg per medium avocado)

You can take magnesium as a supplement, but dietitians recommend you try to get it from food sources before going that route. Always talk to your doctor before taking any supplement. 

Some health problems can affect the amount of magnesium in your body. Your doctor may want to monitor your magnesium levels with a test if you have:

  • Chronic kidney disease
  • Uncontrolled diabetes 
  • Alcohol use disorder
  • Malabsorption syndrome (your body has trouble absorbing nutrients from food)
  • Malnutrition
  • Chronic (long-lasting) diarrhea
  • Low levels of potassium and/or calcium

Some medications can raise or lower your magnesium levels, such as: 

  • Diuretics (also called water pills)
  • Certain antibiotics
  • Proton pump inhibitors to reduce stomach acid
  • Medicines that can increase magnesium levels, such as aspirin, lithium, laxatives, and antacids

Your body functions best when your magnesium levels are balanced—not too high and not too low.

Normal magnesium levels

A normal range for magnesium levels in your blood is 1.7 to 2.2 mg/dL. If, from time to time, your diet isn't giving you enough magnesium, your body can maintain this normal range because of the stores of magnesium in your bones. Your body also has a way to get rid of extra magnesium if your levels are high. 

What is a magnesium deficiency?

A deficiency is when you have lower than normal levels of a nutrient. It's not common to have magnesium deficiency. Doctors don't test for magnesium levels in routine blood tests. But there are signs and symptoms that may tell them it's time to check out your magnesium levels.

Having low magnesium levels is also called hypomagnesemia. Only about 2% of people in the general population have it. 

What causes low magnesium levels?

Aside from medical conditions and medications that may cause it, your chances of having a magnesium deficiency go up if you have a stay in the hospital, have an alcohol use disorder, or your diabetes isn't well-controlled. 

Low magnesium symptoms

Not having enough magnesium in your body can cause:

  • Tremors
  • Muscle spasms
  • Muscle cramps and/or numbness in your hands and feet
  • Abnormal eye movements (nystagmus)
  • Fatigue and weakness

If your magnesium levels get dangerously low, you may:

  • Have seizures
  • Feel confused
  • Have abnormal heart rhythms (arrhythmia)

It's very uncommon to have too much magnesium in your body, but if you do, it's called hypermagnesemia. 

What causes high magnesium levels?

Most cases of high magnesium happen in people who live with kidney disease. Some older adults with kidney disease may not absorb magnesium correctly, causing it to build up in their body. Your risk of this goes up if you regularly take medications with magnesium, such as antacids or laxatives. 

You may also get it if you have:

  • Hypothyroidism (when your thyroid glands don't make enough thyroid hormones) 

  • Cortico-adrenal insufficiency (when adrenal glands don't make enough of the hormone cortisol)

High magnesium symptoms

If you have too much magnesium in your system, you might have:

  • Low blood pressure (hypotension)
  • Heart arrhythmias
  • Confusion
  • Weakness and lack of energy

A test called a serum magnesium test measures the amount of magnesium you have in your bloodstream. To do the test, your doctor will draw a blood sample from a vein in your arm with a small needle. They'll send this sample to a lab to test the magnesium levels. 

Your doctor can also test the amount of magnesium in your urine. A magnesium urine test isn't the normal urine test you might be used to, where you pee into a cup at your doctor's office and they send only that sample for testing. A magnesium urine test usually involves collecting your pee over 24 hours This is because your levels may go up and down based on the foods you've eaten that day.

This test measures the levels of magnesium inside your red blood cells. It may be a more sensitive test for detecting low levels of magnesium than a regular magnesium blood test. 

Just like a magnesium blood test, a technician takes a vial of blood from a vein in your arm and sends it to a lab for testing. 

For this test, your doctor gently swipes the inside of your cheeks to gather cells that they then wipe on a test strip. The test strip goes to a lab for analysis. 

At the lab, an electron microscope scans the cells and sends X-rays through them. Different minerals in your cells release different amounts of energy. The test can see how much magnesium you have based on these readings. 

Magnesium is an essential mineral your body needs for multiple functions, such as energy production, making protein, helping muscles contract, and maintaining healthy bones and a healthy heart. You can get it from foods such as green leafy vegetables, whole grains, beans, and nuts.

Most people get enough magnesium from a well-balanced diet, but certain conditions can raise or lower your levels. Having too much or too little magnesium causes certain symptoms, some of which can be serious. Your doctor can do tests to find out what your magnesium levels are.