Hepatic conversion to bile acids is a major elimination route for cholesterol in mammals. CYP7A1 catalyzes the first and rate-limiting step in classic bile acid biosynthesis, converting cholesterol to 7α-hydroxycholesterol. To identify the structural determinants that govern the stereospecific hydroxylation of cholesterol, we solved the crystal structure of CYP7A1 in the ligand-free state. The structure-based mutation T104L in the B' helix, corresponding to the nonpolar residue of CYP7B1, was used to obtain crystals of complexes with cholest-4-en-3-one and with cholesterol oxidation product 7-ketocholesterol (7KCh). The structures reveal a motif of residues that promote cholest-4-en-3-one binding parallel to the heme, thus positioning the C7 atom for hydroxylation. Additional regions of the binding cavity (most distant from the access channel) are involved to accommodate the elongated conformation of the aliphatic side chain. Structural complex with 7KCh shows an active site rigidity and provides an explanation for its inhibitory effect. Based on our previously published data, we proposed a model of cholesterol abstraction from the membrane by CYP7A1 for metabolism. CYP7A1 structural data provide a molecular basis for understanding of the diversity of 7α-hydroxylases, on the one hand, and cholesterol-metabolizing enzymes adapted for their specific activity, on the other hand.