Based on the results of a computational model of thymic selection, we propose a mechanism that produces the observed wide range of T cell cross-reactivity. The model suggests that the cross-reactivity of a T cell that survives thymic selection is correlated with its affinity for self peptides. In order to survive thymic selection, a T cell with low affinity for all self peptides expressed in the thymus must have high affinity for major histocompatibility complex (MHC), which makes it highly cross-reactive. A T cell with high affinity for any self peptide must have low MHC affinity to survive selection, which makes it highly specific for its cognate peptide. Our model predicts that (1) positive selection reduces by only 17% the number of T cells that can detect any given foreign peptide, even though it eliminates over 95% of pre-selection cells; (2) negative selection decreases the average cross-reactivity of the pre-selection repertoire by fivefold; and (3) T cells responding to foreign peptides similar to self peptides will have a lower average cross-reactivity than cells responding to epitopes dissimilar to self.