Health News

Which is best for immunity and energy?

Key takeaways

  • Magnesium supports normal immune function and energy production by regulating inflammation, gut health and how cells convert food into energy.
  • Vitamin D plays a more direct role in immune defense and muscle function, with low levels linked to infections, muscle weakness and fatigue.
  • Magnesium and vitamin D supplements are very useful in correcting a deficiency.

Magnesium and vitamin D both play important roles in immune health and energy, but they work in very different ways. Understanding what each does can help clarify when one may be more beneficial than the other.

Magnesium supports immune cells

Magnesium is a mineral that the body uses to perform many basic functions. For the immune system, magnesium helps control inflammation and supports normal immune cell activity.

When magnesium levels are low, the body is more likely to remain in a state of ongoing, low-level inflammation. Over time, this can make it more difficult for the immune system to respond effectively to illness. Magnesium also contributes to the maintenance of the intestinal microbiota, which plays a key role in immune defense.

Magnesium does not directly fight infections. Instead, it helps the immune system function normally by supporting the processes that allow immune cells to respond appropriately.

Vitamin D plays a more direct role in immunity

Vitamin D plays a more direct role in immune health. Many immune cells rely on vitamin D to help them recognize and respond to viruses and bacteria.

Low levels of vitamin D have been linked to a higher risk of respiratory infections. Having enough vitamin D helps support both the body’s first line of defense and its long-term immune response.

However, taking a vitamin D supplement beyond what the body needs does not improve immunity and may increase the risk of side effects.

Magnesium converts food into energy

Magnesium plays a direct role in how the body produces energy. It helps convert food into a form of energy that cells can use throughout the day.

If magnesium levels are low, this process may become less efficient, which can contribute to fatigue. Magnesium also supports normal muscle and nerve function and helps regulate sleep, both of which can affect a person’s feeling of energy.

People with low magnesium intake or higher needs due to stress or physical activity may see energy improvements when their levels are corrected.

Magnesium plays a more direct role in energy production at the cellular level, while vitamin D indirectly affects energy by supporting muscle function and physical performance.

The effect of any one nutrient on energy levels can vary depending on whether a person is deficient or not and what factors contribute to their fatigue.

Vitamin D supports muscles

Vitamin D does not directly create energy. Instead, it supports muscle strength and movement, which can affect physical endurance and overall energy.

Low levels of vitamin D are often associated with muscle weakness and fatigue. Some studies suggest that correcting a deficiency could help reduce fatigue, particularly in people with very low levels.

In people who already have enough vitamin D, supplementation is unlikely to improve energy levels.

Recommended daily intakes for magnesium and vitamin D

In addition to supplements, magnesium is found in foods such as nuts, seeds, beans, whole grains, and leafy greens. Vitamin D comes from fatty fish, fortified foods and exposure to sunlight.

Here is the amount you need per day:

Magnesium:

  • Adult women: 310 to 320 milligrams per day
  • Adult men: 400 to 420 milligrams per day

Vitamin D:

  • Most adults: 600 to 800 IU per day
  • Some people may need higher doses to correct a deficiency, under medical supervision.

Potential Risks and Safety of Supplements

  • Magnesium supplements may cause diarrhea or stomach upset, especially at higher doses. People with kidney disease should avoid magnesium supplements unless advised otherwise by a healthcare professional.
  • Vitamin D supplements excessive consumption can lead to high calcium levels, kidney problems and other health problems.

Both supplements are most effective when used to correct a deficiency, rather than when taken in high doses with the expectation of additional immune or energy benefits.

Verywell Health uses only high-quality sources, including peer-reviewed studies, to support the facts in our articles. Read our editorial process to learn more about how we fact-check and keep our content accurate, reliable, and trustworthy.
  1. Veronese N, Pizzol D, Smith L, Dominguez LJ, Barbagallo M. Effect of magnesium supplementation on inflammatory parameters: a meta-analysis of randomized controlled trials. Nutrients. 2022;14(3):679. doi:10.3390/nu14030679

  2. Ashique S, Kumar S, Hussain A et al. A narrative review on the role of magnesium in immune regulation, inflammation, infectious diseases and cancer. J Health Popul Nutr. 2023;42:74. doi:10.1186/s41043-023-00423-0

  3. Schiopu C, Stefanescu G, Diaconescu, S, Bălan G, Nicoleta G, Elena R, Cosmin M, Popa B, Tataranu E, Olteanu V, Boloș A, Ștefănescu, C. Magnesium orotate and modulation of the microbiome-gut-brain axis: new approaches to psychological comorbidities of functional gastrointestinal disorders. Nutrients. 2022;14:1567. two: 10.3390/nu14081567.

  4. Artusa P, White JH. Vitamin D and its analogues in the regulation of the immune system. Pharmacol Rev.. 2025;77(2):100032. doi:10.1016/j.pharmr.2024.100032

  5. Ismailova A, White JH. Vitamin D, infections and immunity. Metabolic disorder Rev Endocr. 2021;23(2):265. doi:10.1007/s11154-021-09679-5

  6. Charoenngam N, Holick MF. Immunological effects of vitamin D on human health and disease. Nutrients. 2020;12(7):2097. doi:10.3390/nu12072097

  7. National Institutes of Health. Vitamin D: information sheet for health professionals.

  8. National Institutes of Health. Magnesium: information sheet for health professionals.

  9. Romeu Montenegro K, Carlessi R, Cruzat V, Newsholme P. Effects of vitamin D on proliferation, differentiation, protein synthesis and bioenergetics of primary human skeletal muscle cells. J Steroid Biochem Mol Biol. 2019;193:105423. doi:10.1016/j.jsbmb.2019.105423

  10. Pennisi M, Malaguarnera G, Bartolo GD et al. Decreased serum vitamin D level in elderly patients with fatigue. Nutrients. 2019;11(10):2531. doi:10.3390/nu11102531

  11. Han B, Wu X, Guo Y. Improvement in fatigue after vitamin D supplementation in kidney transplant recipients. Medicine. 2017;96(21):e6918. doi:10.1097/MD.0000000000006918


By Morgan Pearson, MS, RD

Morgan Pearson is a registered dietitian and health writer specializing in nutrition, mental health and fitness. She has several years of experience developing evidence-based health content and enjoys translating complex research into accessible and engaging information.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button