Humans and their microbiota have coevolved a mutually beneficial relationship in which the human host provides a hospitable environment for the microorganisms and the microbiota provides many advantages for the host, including nutritional benefits and protection from pathogen infection1. Maintaining this relationship requires a careful immune balance to contain commensal microorganisms within the lumen while limiting inflammatory anti-commensal responses1,2. Antigen-specific recognition of intestinal microorganisms by T cells has previously been described3,4. Although the local environment shapes the differentiation of effector cells3-5 it is unclear how microbiota-specific T cells are educated in the thymus. Here we show that intestinal colonization in early life leads to the trafficking of microbial antigens from the intestine to the thymus by intestinal dendritic cells, which then induce the expansion of microbiota-specific T cells. Once in the periphery, microbiota-specific T cells have pathogenic potential or can protect against related pathogens. In this way, the developing microbiota shapes and expands the thymic and peripheral T cell repertoire, allowing for enhanced recognition of intestinal microorganisms and pathogens.