Your skin makes vitamin D when it is exposed to ultraviolet B (UVB) rays from the sun. The process is straightforward: UVB light hits a cholesterol compound in your skin, converts it into vitamin D, and your liver and kidneys finish the job by turning it into the active form your body can use. Sun exposure is the most natural way to get vitamin D, but it comes with a real trade-off — the same UVB rays that help you also cause skin damage and raise skin cancer risk. The goal is to get enough sun for vitamin D without overdoing it.
How does the body actually make vitamin D from sunlight?
The process begins the moment UVB rays reach your bare skin. Your skin contains a compound called 7-dehydrocholesterol, which is a precursor to vitamin D. When UVB light hits it, the compound changes shape and becomes previtamin D3. Within hours, your body’s natural warmth converts previtamin D3 into vitamin D3, also called cholecalciferol.
Vitamin D3 travels through your bloodstream to your liver. The liver adds a hydroxyl group to it, creating calcidiol. This is the storage form doctors measure when they test your vitamin D levels. From there, calcidiol moves to your kidneys, where it becomes calcitriol — the active form your muscles, immune system, and bones actually use.
This whole chain depends on UVB exposure. UVA rays, which are also in sunlight, do not trigger vitamin D production. That distinction matters because many people assume any sun exposure works. It does not. Only UVB does.
How much sun do you need for vitamin D?
There is no single answer that works for everyone. Skin tone, latitude, season, time of day, and how much skin is exposed all change the math. A fair-skinned person in Miami at noon in July needs far less sun than a darker-skinned person in Boston in February.
General guidance suggests 10 to 30 minutes of midday sun several times per week on exposed arms and legs. That estimate applies to lighter skin tones and assumes you are outdoors when the sun is high. People with darker skin need more time because melanin absorbs UVB rays, reducing the amount that reaches the skin layers where vitamin D forms.
Latitude and season matter enormously. If you live above roughly 37 degrees north — think Richmond, Virginia, or anywhere north of it — the sun’s angle from November through February is too low for UVB to reach you effectively. During those months, your skin makes little to no vitamin D no matter how long you stay outside. The same applies to southern latitudes during winter, just for a shorter window.
What factors reduce vitamin D production from sun exposure?
- Sunscreen: SPF 30 blocks about 95 to 97 percent of UVB rays. That dramatically reduces vitamin D synthesis. This is why some people skip sunscreen to “get their vitamin D.”
- Clothing: Fabric blocks UVB completely. Only uncovered skin produces vitamin D.
- Glass: Standard window glass blocks UVB. Sitting by a sunny window does not help your vitamin D levels.
- Skin pigmentation: Melanin absorbs UVB. Darker skin requires significantly more sun exposure to produce the same amount of vitamin D as lighter skin.
- Age: Older skin contains less 7-dehydrocholesterol, so it produces less vitamin D from the same amount of sun.
- Time of day: UVB is strongest when the sun is highest in the sky, roughly between 10 a.m. and 3 p.m. Early morning and late afternoon sun produces less vitamin D.
These factors stack. A person over 60 with darker skin living in a northern climate can spend an hour outside in winter and produce almost no vitamin D. Sun exposure alone may never be enough for that person.
What is the safe balance between vitamin D and skin cancer risk?
This is the central tension. The sun is the most efficient source of vitamin D, but it is also the primary cause of skin cancer, including melanoma. Dermatology organizations consistently recommend against intentional sun exposure as a vitamin D strategy. The American Academy of Dermatology’s position is that you should get vitamin D from food and supplements, not from the sun.
That said, most people do not spend their entire lives indoors. Incidental sun exposure — the few minutes you spend walking to your car, hanging laundry, or gardening — contributes to your vitamin D status. For many people, this incidental exposure is enough, especially in summer months and at lower latitudes.
The practical approach is this: do not bake in the sun to chase vitamin D. If you are going to be outside for more than a few minutes, wear sunscreen. The small amount of vitamin D lost by using sunscreen is far less harmful than the increased skin cancer risk from unprotected exposure.
How do you know if your vitamin D levels are low?
You cannot reliably tell from symptoms alone. Many people with low vitamin D have no symptoms at all. When symptoms do appear, they are vague — fatigue, bone pain, muscle weakness, or mood changes. These overlap with dozens of other conditions, so guessing is not useful.
The only reliable way to know your vitamin D status is a blood test. Doctors measure calcidiol, the storage form, and report it in nanograms per milliliter (ng/mL). Most laboratories consider levels below 20 ng/mL deficient, and levels of 20 to 30 ng/mL insufficient. Many experts recommend aiming for 30 to 50 ng/mL, though there is ongoing debate about what the optimal range really is.
If you are concerned about your vitamin D levels, ask your doctor for a blood test rather than assuming based on how much sun you get. Many people with significant sun exposure still test low, especially if they live in northern climates or have darker skin.
What are the best alternatives to sun exposure for vitamin D?
Food sources are limited but real. Fatty fish like salmon, mackerel, and sardines contain vitamin D3. Egg yolks, beef liver, and some mushrooms provide smaller amounts. Many countries fortify foods — milk, orange juice, and breakfast cereals commonly have added vitamin D. But even with fortified foods, reaching adequate levels through diet alone is difficult.
Supplements are the most reliable option. Vitamin D3 supplements are well absorbed and have a long safety record at recommended doses. The recommended daily allowance for most adults is 600 to 800 IU per day, though some people need more to correct a deficiency. Your doctor can recommend a dose based on your blood test results.
One important note: vitamin D is fat-soluble. Your body stores it, and taking extremely high doses over long periods can cause toxicity. More is not better. The safe upper limit for adults is generally considered 4,000 IU per day, but you should not exceed that without medical supervision.
Do sunbeds and tanning lamps work for vitamin D?
Some tanning beds emit UVB, which means they can stimulate vitamin D production. That does not make them a good idea. Tanning beds are classified as carcinogenic by the World Health Organization. They increase the risk of melanoma and other skin cancers, and there is no evidence that using them for vitamin D is worth that risk.
There are also vitamin D lamps designed specifically to emit UVB for people with medical conditions that prevent sun exposure. These are prescription devices in many places and are used under medical supervision. They are not the same as commercial tanning beds, and they are not something to buy casually.
Frequently Asked Questions
How long should I stay in the sun to get vitamin D?
For lighter skin, roughly 10 to 30 minutes of midday sun on exposed arms and legs, several times per week, is a common estimate. People with darker skin or older adults need more time, and people in northern latitudes during winter may not produce vitamin D at all.
Can I get vitamin D through a window?
No. Standard window glass blocks UVB rays, which are the only rays that trigger vitamin D production. Sitting in sunlight indoors does not raise your vitamin D levels.
Is sunscreen stopping me from getting vitamin D?
Sunscreen does reduce vitamin D production because it blocks UVB rays. However, incidental sun exposure and the fact that most people do not apply sunscreen perfectly mean that sunscreen use does not usually cause deficiency on its own.
What is the best time of day to get vitamin D from the sun?
Midday, roughly between 10 a.m. and 3 p.m., is when UVB rays are strongest and vitamin D production is most efficient. This is also when sunburn risk is highest, so keep exposure short.

