This synthesis takes place in the skin when it is exposed to ultraviolet (UV) radiation from sunlight. Specifically, the UV rays convert 7-dehydrocholesterol into cholecalciferol (vitamin D3).
However, this is only the first step. Cholecalciferol then needs to be further modified in the liver and kidneys to become the active form of vitamin D, called calcitriol.
Therefore, while the initial synthesis of vitamin D occurs in the skin, it requires subsequent modifications in the liver and kidneys to become biologically active.