Stem-like T cells are attractive immunotherapeutic targets in patients with cancer given their ability to proliferate and differentiate into effector progeny. Thus, identifying T cells with enhanced stemness and understanding their developmental requirements are of broad clinical and therapeutic interest. Here, we demonstrate that during acute infection, the transcriptional regulator inhibitor of DNA binding 3 (ID3) identifies stem-like T cells that are uniquely adapted to generate precursors of exhausted T (Tpex) cells in response to chronic infection or cancer. Expression of ID3 itself enables Tpex cells to sustain T cell responses in chronic infection or cancer, whereas loss of ID3 results in impaired maintenance of CD8 T cell immunity. Furthermore, we demonstrate that interleukin-1 (IL-1) family members, including IL-36β and IL-18, promote the generation of ID3