The microenvironments of the thymus are generated by thymic epithelial cells (TECs) and are essential for inducing immune self-tolerance or developing T cells. However, the molecular mechanisms that underlie the differentiation of TECs and thymic compartmentalization are not fully understood. Here we show that deficiency in the tumor necrosis factor receptor-associated factor (TRAF) 6 results in disorganized distribution of medullary TECs (mTECs) and the absence of mature mTECs. Engraftment of thymic stroma of TRAF6(-/-) embryos into athymic nude mice induced autoimmunity. Thus, TRAF6 directs the development of thymic stroma and represents a critical point of regulation for self-tolerance and autoimmunity.