Major histocompatibility complex (MHC) class I molecules present thousands of peptides to allow CD8(+) T cells to detect abnormal intracellular proteins. The antigen-processing pathway for generating peptides begins in the cytoplasm, and the MHC molecules are loaded in the endoplasmic reticulum. However, the nature of peptide pool in the endoplasmic reticulum and the proteolytic events that occur in this compartment are unclear. We addressed these issues by generating mice lacking the endoplasmic reticulum aminopeptidase associated with antigen processing (ERAAP). We found that loss of ERAAP disrupted the generation of naturally processed peptides in the endoplasmic reticulum, decreased the stability of peptide-MHC class I complexes and diminished CD8(+) T cell responses. Thus, trimming of antigenic peptides by ERAAP in the endoplasmic reticulum is essential for the generation of the normal repertoire of processed peptides.