Somatic rearrangement of the genes encoding antigen receptors allows the mammalian immune system to produce receptors that can recognize virtually any foreign protein. This rearrangement process also generates nonfunctional antigen receptors as well as receptors that can recognize self-proteins. During thymic development, T cells go through a testing process which ensures that cells expressing useless or harmful antigen receptors do not mature. The selection of T cells in the thymus consists of several components driven by distinct recognition events that have distinct consequences for the cell. T cell selection appears to begin before the rearrangement process is complete. Evidence is emerging that T cells have a developmental checkpoint to make sure that the antigen receptor beta gene is successfully rearranged before development can proceed. This checkpoint also appears to be linked to the regulation of rearrangement and mechanisms to ensure that each cell expresses only one antigen receptor (allelic exclusion). After a T cell has successfully rearranged and expressed both its alpha and beta antigen receptor genes, a second phase of selection occurs. During this phase, T cells with self-reactive antigen receptors are eliminated by negative selection, and T cells that can recognize foreign peptides bound to polymorphic self-MHC molecules are selected to mature (positive selection. How these seemingly incompatible forms of selection both occur is a subject of considerable interest. Positive selection is linked also to the choice between the CD4 helper lineage and the CD8 cytotoxic T cell lineage; the mechanisms by which these two events are linked is an ongoing area of investigation.