We’ve all heard about vitamin D and its importance in immunity, but how do we get it safely from the sun when we also have to balance worries about the health risks of UV rays? In this article, we’ll cover why vitamin D matters for immune function, how to get it safely from food and supplements, and how to make our own by practicing safe sun exposure while still protecting our skin from UV damage. 

Vitamin D and Immunity

Vitamin D is an important immunoregulatory vitamin with the potential to reduce the risk of severe illness (including pneumonia) from community-acquired viruses. The role of vitamin D in the human body is complex, in part because so many different types of cells contain vitamin D receptors. In the immune system, vitamin D appears to influence B and T cells, which are some of the body’s first-line defenses when it comes to recognizing and destroying pathogens. B and T cells are produced in bone marrow, which is maintained in part using vitamin D’s regulation of calcium metabolism. 

Importance of Vitamin D During Pandemics

Several studies have now established that healthy vitamin D levels can lessen the severity of viral illnesses. The higher your vitamin D levels are when you are exposed to a virus, the better chances you have of not getting seriously ill or dying from it. 

Vitamin D is also associated with less risk of severe illness from other infections like streptococcal bacterial infections, the flu, and more. If projections are right, we’re likely to experience an increasing number of pandemics caused by vector-borne illnesses like viruses and bacteria over the next 50-100 years. It’s a good strategy to make sure that you and your family members have healthy levels of vitamin D for that reason. You never know when you’ll encounter a bacteria or virus that you’ll need to fight off.

How Much Vitamin D Is Enough?

The short answer is, it depends—both on who you ask and on your individual medical history, diet, and lifestyle. The amount of sun, food, and supplement sources of vitamin D you need each day will change based on your genetics, skin, gut function, health conditions, and stage of life.

Only a blood test can tell you if you’re getting enough. Levels under 30 ng/mL are considered to be low or insufficient, levels between 30-50 ng/mL are suboptimal, and 50-100 is considered adequate. Some medical societies recommend maintaining levels above 75 ng/mL to maintain basic bodily functions like bone remodeling. Your doctor can help you determine how much is right for you, but a number like 50 ng/mL is safe for most people. You can achieve this with a customized combination of safe sun exposure and food/supplement intake.

How to Make Vitamin D from the Sun

Human skin contains an abundance of the cholesterol compound 7-dehydrocholesterol. When this type of cholesterol is exposed to UV-B rays from the sun, it is converted to vitamin D3. This process happens without enzymes—in other words, you only require cholesterol, healthy skin, and time in the sun to make your own vitamin D3! The body can convert D3 to more active forms of vitamin D in the liver and kidneys, which are the forms used throughout the body for a variety of important chemical reactions.

Unfortunately, while this process is simple, it is not reliable or even advisable to rely on this method of obtaining vitamin D alone unless you routinely work outside in the sun and live close to the equator. Here’s why. 

UVB Ray Intensity Varies Based on Location on the Planet

The amount of UV rays that reach the earth’s surface depends on the angle of the sun in the sky and the tilt of the earth depending on the season and latitude. The maximum amount of UVB that reaches the earth’s surface occurs in the summer months at midday in equatorial latitudes. In these conditions, spending a few minutes with a majority of your body’s skin exposed to direct sunlight each day would theoretically allow you to produce approximately 10,000 to 20,000 IU of vitamin D. These levels plummet, however, as you move away from the equator, change the time of day you’re able to go outside, wear clothing, hats or sunscreens, or as the season changes to fall, winter, or spring. Under these conditions, humans are not able to produce as much vitamin D from sun exposure. This is why many physicians recommend that their patients supplement with oral vitamin D capsules in the fall, winter, and spring. The sun’s rays are just not strong enough or hitting the earth at the right angle during these seasons to allow for the natural production of vitamin D.

Risks from Sunburn Exposure Outweigh the (Uncertain) Benefits of Unprotected UVB Radiation

UV-B radiation—the type of ultraviolet radiation that turns cholesterol into pre-vitamin D in the skin—comes with a concerning side effect of DNA damage and increased melanoma risk. There’s a fine line between the amount of UVB required to make enough vitamin D and the amount required to induce a sunburn, which increases the risk of skin cancer. This fine line is measured in seconds or minutes, not hours, and it changes depending on the UV index and the amount of melanin produced in the skin as a result of genetics and recent sun exposure. It’s not reasonable to expect the majority of people to be able to track their changes in vitamin D in real-time (using a blood test) and adjust their sun exposure accordingly, and to be able to predict the exact moment when their skin will start to burn. For that reason, we have to err on the side of caution and advise folks to fully cover their skin in sunscreen to prevent melanoma, even if it means producing less vitamin D. For more on this topic, read the article on how to soothe sunburned skin.

Protect Your Skin from Sunburn, and Enjoy the Gentle Boost in Vitamin D You Still Get

While the evidence is clear that you should wear sunscreen to protect your skin from sun damage and skin cancer, that doesn’t mean that you can’t still make vitamin D while wearing sunscreen! In fact, one study showed that people who used sunscreen during a week-long vacation still enjoyed a 20 point increase in their serum vitamin D after 40 hours in the sun. Additionally, many broad-spectrum sunscreens also contain healthy minerals like zinc, which is also important for immune system function (just don’t buy the nano-particle forms). I advise my clients to always use sunscreen and healthy lifestyle habits to prevent sunburns, to enjoy the boost in vitamin D that they can still get while exposing their sunscreen-protected skin to the sun, and to focus on food and supplement sources of vitamin D for meeting their needs if they have a deficiency. 

Any healthy vitamin D plan includes getting as much sun as you healthfully can without burning using sunscreen and lifestyle, and eating a diet rich in vitamin D-rich foods. If that’s not enough to maintain normal serum levels of vitamin D, ask your doctor about a supplement that can help you get there. 

How to Get Vitamin D from Food

The top 3 food sources of vitamin D include cod liver oil, trout, and salmon. This is because animals and fish—like humans—store vitamin D in their tissues and fat. When we consume those fish liver or animal tissue as food, we also consume the vitamin D they’ve stored up over their lifetimes. Eating a full serving of each of these foods several times per week is a good strategy for getting vitamin D naturally from food if this is part of your health plan. 

How to Supplement with Vitamin D

If you’re vegan, the fact that this “top foods” list consists solely of animal products makes the task of getting enough vitamin D through diet quite challenging. Thankfully, synthetic vegan vitamin D is available as a supplement. You can take it in the form of a vitamin D gummy or vitamin D pill. You should consider taking vitamin D3 rather than D2, since D3 has been shown to help correct vitamin D deficiencies more effectively at the same dose than D2. If you choose to take vitamin D2 instead of D3, make sure to take it every day since it has a shorter half-life than D3. As always, ask your physician which form and dose of vitamin D is right for you.

Vitamin D is Essential for Immune Health

Vitamin D is an important and necessary nutrient with profound impacts on immune health. A combination of sunscreen-protected sun exposure, vitamin D-rich diet, and vitamin D supplements can help you make sure you’re able to take full advantage of this vitamin’s benefits throughout your lifetime. 


  1. Alshahrani, Fahad M., et al. “Vitamin D.” Dermato-Endocrinology, vol. 5, no. 1, Jan. 2013, pp. 177–180, pubmed.ncbi.nlm.nih.gov/24494051/, 10.4161/derm.23351. Accessed 6 Sept. 2021.
  2. Bikle, Daniel D. “Vitamin D Metabolism, Mechanism of Action, and Clinical Applications.” Chemistry & Biology, vol. 21, no. 3, Mar. 2014, pp. 319–329, www.sciencedirect.com/science/article/pii/S1074552114000246#:~:text=Vitamin%20D%20Production&text=D3%20(cholecalciferol)%20is%20produced,thermo%2Dsensitive%20but%20noncatalytic%20process., 10.1016/j.chembiol.2013.12.016. Accessed 5 Sept. 2021.
  3. Borel, P., et al. “Vitamin D Bioavailability: State of the Art.” Critical Reviews in Food Science and Nutrition, vol. 55, no. 9, 2 Oct. 2013, pp. 1193–1205, hal.archives-ouvertes.fr/inserm-01478467, 10.1080/10408398.2012.688897. Accessed 5 Sept. 2021.
  4. Chowdhury, Fazle Rabbi, et al. “Pandemics, Pathogenicity and Changing Molecular Epidemiology of Cholera in the Era of Global Warming.” Annals of Clinical Microbiology and Antimicrobials, vol. 16, no. 1, 7 Mar. 2017, pubmed.ncbi.nlm.nih.gov/28270154/, 10.1186/s12941-017-0185-1. Accessed 5 Sept. 2021.
  5. Cicarma E;Porojnicu AC;Lagunova Z;Dahlback A;Juzeniene A;Moan J. “Sun and Sun Beds: Inducers of Vitamin D and Skin Cancer.” Anticancer Research, vol. 29, no. 9, 2011, pubmed.ncbi.nlm.nih.gov/19667143/, . Accessed 6 Sept. 2021.
  6. Faurschou, A., et al. “The Relation between Sunscreen Layer Thickness and Vitamin D Production after Ultraviolet B Exposure: A Randomized Clinical Trial.” British Journal of Dermatology, vol. 167, no. 2, 26 July 2012, pp. 391–395, pubmed.ncbi.nlm.nih.gov/22512875/, 10.1111/j.1365-2133.2012.11004.x. Accessed 5 Sept. 2021.
  7. Grant, William B., et al. “Evidence That Vitamin D Supplementation Could Reduce Risk of Influenza and COVID-19 Infections and Deaths.” Nutrients, vol. 12, no. 4, 2 Apr. 2020, p. 988, www.ncbi.nlm.nih.gov/pmc/articles/PMC7231123/, 10.3390/nu12040988. Accessed 5 Sept. 2021.
  8. Guevara, Miriam A., et al. “Vitamin D and Streptococci: The Interface of Nutrition, Host Immune Response, and Antimicrobial Activity in Response to Infection.” ACS Infectious Diseases, vol. 6, no. 12, 10 Nov. 2020, pp. 3131–3140, www.ncbi.nlm.nih.gov/pmc/articles/PMC7852033/, 10.1021/acsinfecdis.0c00666. Accessed 6 Sept. 2021.
  9. “Office of Dietary Supplements - Vitamin D.” Nih.gov, 2017, ods.od.nih.gov/factsheets/VitaminD-HealthProfessional/. Accessed 5 Sept. 2021.
  10. Passeron, T., et al. “Sunscreen Photoprotection and Vitamin D Status.” British Journal of Dermatology, vol. 181, no. 5, 15 July 2019, pp. 916–931, pubmed.ncbi.nlm.nih.gov/31069788/, 10.1111/bjd.17992. Accessed 5 Sept. 2021.
  11. Stamp, T.C.B., et al. “COMPARISON of ORAL 25-HYDROXYCHOLECALCIFEROL, VITAMIN D, and ULTRAVIOLET LIGHT as DETERMINANTS of CIRCULATING 25-HYDROXYVITAMIN D.” The Lancet, vol. 309, no. 8026, June 1977, pp. 1341–1343, pubmed.ncbi.nlm.nih.gov/69059/, 10.1016/s0140-6736(77)92553-3. Accessed 6 Sept. 2021.
  12. Tripkovic, Laura, et al. “Daily Supplementation with 15 Μg Vitamin D 2 Compared with Vitamin D 3 to Increase Wintertime 25-Hydroxyvitamin D Status in Healthy South Asian and White European Women: A 12-Wk Randomized, Placebo-Controlled Food-Fortification Trial.” The American Journal of Clinical Nutrition, vol. 106, no. 2, 5 July 2017, pp. 481–490, pubmed.ncbi.nlm.nih.gov/28679555/, 10.3945/ajcn.116.138693. Accessed 5 Sept. 2021.
  13. Young, A.R., et al. “Optimal Sunscreen Use, during a Sun Holiday with a Very High Ultraviolet Index, Allows Vitamin D Synthesis without Sunburn.” British Journal of Dermatology, vol. 181, no. 5, 24 May 2019, pp. 1052–1062, www.ncbi.nlm.nih.gov/pmc/articles/PMC6899952/, 10.1111/bjd.17888. Accessed 5 Sept. 2021.