Vitamin D was discovered in 1922 following on from previous research. American researchers Elmer McCollum and Marguerite Davis in 1914 discovered a substance in cod liver oil which later was called "vitamin A". British doctor Edward Mellanby noticed dogs that were fed cod liver oil did not develop rickets and concluded vitamin A, or a closely associated factor, could prevent the disease. In 1922, Elmer McCollum tested modified cod liver oil in which the vitamin A had been destroyed. The modified oil cured the sick dogs, so McCollum concluded the factor in cod liver oil which cured rickets was distinct from vitamin A. He called it vitamin D because he thought it was the fourth vitamin to be named. It was not initially realized that vitamin D can be synthesized by humans (in the skin) through exposure to UV light, and therefore is technically not a vitamin, but rather can be considered to be a hormone.
In 1925, it was established that when 7-dehydrocholesterol is irradiated with light, a form of a fat-soluble substance is produced (now known as D). Alfred Fabian Hess stated: "Light equals vitamin D." Adolf Windaus, at the University of Göttingen in Germany, received the Nobel Prize in Chemistry in 1928 for his work on the constitution of sterols and their connection with vitamins. In 1929, a group at NIMR in Hampstead, London, were working on the structure of vitamin D, which was still unknown, as well as the structure of steroids. A meeting took place with J.B.S. Haldane, J.D. Bernal, and Dorothy Crowfoot to discuss possible structures, which contributed to bringing a team together. X-ray crystallography demonstrated the sterol molecules were flat, not as proposed by the German team led by Windaus. In 1932, Otto Rosenheim and Harold King published a paper putting forward structures for sterols and bile acids which found immediate acceptance. The informal academic collaboration between the team members Robert Benedict Bourdillon, Otto Rosenheim, Harold King, and Kenneth Callow was very productive and led to the isolation and characterization of vitamin D. At this time, the policy of the Medical Research Council was not to patent discoveries, believing the results of medical research should be open to everybody. In the 1930s, Windaus clarified further the chemical structure of vitamin D.
In 1923, American biochemist Harry Steenbock at the University of Wisconsin demonstrated that irradiation by ultraviolet light increased the vitamin D content of foods and other organic materials. After irradiating rodent food, Steenbock discovered the rodents were cured of rickets. Using  of his own money, Steenbock patented his invention. His irradiation technique was used for foodstuffs, most notably for milk. By the expiration of his patent in 1945, rickets had been all but eliminated in the US.
In 1969, a specific binding protein for vitamin D called the vitamin D receptor was identified. Shortly thereafter, the conversion of vitamin D to calcifediol and then to calcitriol, the biologically active form, was confirmed. The photosynthesis of vitamin D in skin via previtamin D and its subsequent metabolism was described in 1980.