Abstract The obligatory step in sterol biosynthesis in eukaryotes is demethylation of sterol precursors at the C14-position, which is catalyzed by CYP51 (sterol 14-alpha demethylase) in three sequential reactions. In mammals, the final product of the pathway is cholesterol, while important intermediates, meiosis-activating sterols, are produced by CYP51. Three crystal structures of human CYP51, ligand-free and complexed with antifungal drugs ketoconazole and econazole, were determined, allowing analysis of the molecular basis for functional conservation within the CYP51 family. Azole binding occurs mostly through hydrophobic interactions with conservative residues of the active site. The substantial conformational changes in the B′ helix and F–G loop regions are induced upon ligand binding, consistent with the membrane nature of the protein and its substrate. The access channel is typical for mammalian sterol-metabolizing P450 enzymes, but is different from that observed in Mycobacterium tuberculosis CYP51. Comparison of the azole-bound structures provides insight into the relative binding affinities of human and bacterial P450 enzymes to ketoconazole and fluconazole, which can be useful for the rational design of antifungal compounds and specific modulators of human CYP51.