Abstract T cells are a group of lymphocytes that play a central role in the immune system, notably, eliminating pathogens and attacking cancer while being tolerant of the self. Elucidating how immune tolerance is ensured has become a significant research issue for understanding the pathogenesis of autoimmune diseases as well as cancer immunity. T cell immune tolerance is established mainly in the thymic medulla by the removal of self-responsive T cells and the generation of regulatory T cells, this process depends mainly on the expression of a variety of tissue restricted antigens (TRAs) by medullary thymic epithelial cells (mTECs). The expression of TRAs is known to be regulated by at least two independent factors, Fezf2 and Aire, which play non-redundant and complementary roles by different mechanisms. In this review, we introduce the molecular logic of thymic self-antigen expression that underlies T cell selection for the prevention of autoimmunity and the establishment of immune surveillance.