It is an object of the present invention to provide methods for producing vitamin D that gives improved yields and reduced side product contamination. In various aspects, these methods provide for production of vitamin-D2 using ergosterol as provitamin D2 or a dihydroxy derivative thereof as a starting material, or production of vitamin-D3 using 7-dehydrocholesterol as provitamin D3 or a dihydroxy derivative thereof as the starting material. The methods described herein comprise irradiating the starting material in a solution including an organic or inorganic base with light in the wavelength range 245-360 nanometers (nm) to obtain a product containing pre-vitamin-D2 or pre-vitamin-D3, and heating the product to convert the resulting pre-vitamin-D2 or pre-vitamin-D3 to vitamin D2 or vitamin D3. In various embodiments, these methods further comprise recovering vitamin D2 or vitamin D3 from this reaction as a purified product.