Magnesium deficiency, orhypomagnesemia, occurs whenmagnesiumlevels in your body are below what is needed to function normally.
Magnesium is absorbedin the stomach andsmall intestines.
They do so by either increasing or decreasing how much magnesium is eliminated in urine.

Verywell / Ellen Lindner
Magnesium deficiency is diagnosed with ablood test.
Foods high in magnesiuminclude:
Do I Need to Take a Magnesium Supplement?
Most people get more than enough magnesium from foods and do not need magnesium supplements.
There are also different types, including magnesium oxide, magnesium citrate, magnesium gluconate, and magnesium chloride.
Liquids or powders that dissolve well in fluids often have better intestinal absorption rates than pills.
This is usually performed in a hospital and needs to be monitored carefully by a healthcare professional.
Summary
Magnesium deficiency due to low dietary intake in otherwise-healthy people is uncommon.
Your doctor may suggest oral supplements to treat mild magnesium deficiency.
Be aware of the side effects of oral magnesium, which include diarrhea, nausea, and vomiting.
Drugs and supplements can sometimes interfere with each other and disrupt the balance in the body.
Office of Dietary Supplements.Magnesium.
Ahmed F, Mohammed A.Magnesium: the forgotten electrolytea review on hypomagnesemia.Med Sci.
2019;7(4):56. doi:10.3390/medsci7040056
Medline Plus.Fluid and electrolyte balance.