The thymic medulla provides a microenvironment where medullary thymic epithelial cells (mTECs) contribute to the establishment of self-tolerance by the deletion of self-reactive T cells and the generation of regulatory T cells. The progression of thymocyte development critically regulates the optimum formation of the thymic medulla, as discussed in this article. Of note, it was recently identified that RANKL produced by positively selected thymocytes plays a major role in the thymocyte-mediated medulla formation. Indeed, transgenic expression of soluble RANKL increased the number of mTECs and enlarged the thymic medulla in mice. The effects of RANKL on the thymic medulla may be useful for the engineering of self-tolerance in T cells.