Ecdysteroids are the hormones regulating development, physiology and fertility in arthropods, which synthesize them exclusively from dietary sterols. But how dietary sterol diversity influences the ecdysteroid profile, how animals ensure the production of desired hormones and whether there are functional differences between different ecdysteroids produced in vivo remains unknown. This is because currently there is no analytical technology for unbiased, comprehensive and quantitative assessment of the full complement of endogenous ecdysteroids. We developed a new LC-MS/MS method to screen the entire chemical space of ecdysteroid-related structures and to quantify known and newly discovered hormones and their catabolites. We quantified the ecdysteroidome in Drosophila melanogaster and investigated how the ecdysteroid profile varies with diet and development. We show that Drosophila can produce four different classes of ecdysteroids, which are obligatorily derived from four types of dietary sterol precursors. Drosophila makes makisterone A from plant sterols and epi-makisterone A from ergosterol, the major yeast sterol. However, they prefer to selectively utilize scarce ergosterol precursors to make a novel hormone 24,28-dehydromakisterone A and trace cholesterol to synthesize 20-hydroxyecdysone. Interestingly, epi-makisterone A supports only larval development, whereas all other ecdysteroids allow full adult development. We suggest that evolutionary pressure against producing epi-C-24 ecdysteroids might explain selective utilization of ergosterol precursors and the puzzling preference for cholesterol.