When skin is exposed to sunlight, ultraviolet B (UVB) rays penetrate the skin and convert 7-dehydrocholesterol (a compound in skin oils) into Vitamin D3 (cholecalciferol). This is the primary way humans obtain Vitamin D, which is essential for bone health, immune function, and calcium absorption. The process is a natural biochemical reaction, not related to bacteria or tanning.