During an immune response, peripheral T-cell populations expand and then contract as the response subsides, thus maintaining a fairly constant number of CD4 and CD8 T cells throughout the life of the individual. The important factors that control this homeostasis are now beginning to be understood. Interleukin-7 (IL-7) has emerged as a central regulator of the survival and homeostasis of CD4 and CD8 T cells. Both naive and memory T-cell populations are highly dependent on the presence of IL-7 for their persistence and survival. In this Review, we discuss the role of IL-7 in the survival and homeostasis of naive and memory T cells and how that role is regulated by other factors.