The enzyme cyclodextrin glycosyltransferase is closely related to alpha-amylases but has the unique ability to produce cyclodextrins (circular alpha(1-->4)-linked glucoses) from starch. To characterize this specificity we determined a 1.8-Angstrom structure of an E257Q/D229N mutant cyclodextrin glycosyltransferase in complex with its product gamma-cyclodextrin, which reveals for the first time how cyclodextrin is competently bound. Across subsites -2, -1, and fl, the cyclodextrin ring binds in a twisted mode similar to linear sugars, giving rise to deformation of its circular symmetry. At subsites -3 and +2, the cyclodextrin binds in a manner different from linear sugars. Sequence comparisons and site-directed mutagenesis experiments support the conclusion that subsites -3 and +2 confer the cyclization activity in addition to subsite -6 and Tyr-195, On this basis, a role of the individual residues during the cyclization reaction cycle is proposed