Search "how much sun for vitamin D" and you'll get a confident number — "10–30 minutes a few times a week." It's not wrong so much as incomplete: the same 20 minutes can produce a lot of vitamin D or almost none, depending on five things.
Vitamin D is made when UVB hits your skin. UVB rises and falls with the sun's height in the sky, so it peaks around solar noon and collapses in the early morning, late afternoon, and winter. Below a UV Index of about 3, there's little useful UVB for vitamin D even if it feels bright. A useful rule of thumb: if your shadow is longer than you are tall, the sun is too low to make much vitamin D.
Melanin is natural sun protection, which also means darker skin synthesizes vitamin D more slowly. A person with very fair skin (Fitzpatrick I–II) might make a target dose in a few minutes of strong sun; someone with deep skin (Fitzpatrick V–VI) may need several times longer for the same amount. This is established, not controversial — and it's why one-size-fits-all advice fails.
Vitamin D is made across the surface area exposed. Face and hands is maybe ~10% of your body; shorts and a t-shirt is closer to ~30–40%. More bare skin means more synthesis in less time — and it's the single biggest lever most people ignore.
Here's the counter-intuitive part: UVB drops off faster than overall UV as the sun gets lower. So winter sun, and early/late-day sun, is disproportionately weak for vitamin D even when your skin still feels warm. Above roughly 35–40° latitude, for several winter months, the midday sun simply can't make meaningful vitamin D at all (more in our winter guide).
Your skin doesn't keep making vitamin D indefinitely. Synthesis self-limits as you approach the point where skin starts to redden, then effectively stops — while extra time only adds burn risk. This is the key insight: for vitamin D, there's a sweet spot, and it sits comfortably below a sunburn. Staying out longer "to get more" past that point gives you sun damage, not more vitamin D.
For fair-to-medium skin, a good chunk of skin bare, under strong summer sun (UV Index 6–8), a meaningful dose can happen in roughly 10–20 minutes — often before you'd burn. For darker skin, low sun, or more clothing, it's longer, and in winter at high latitude it may be impossible from sun alone. That range is exactly why a fixed number misleads.