Taken together, our study unravels a previously unappreciated CD4+ T cell-derived IL-21–BATF axis that could provide therapeutic insights to enhance effector CD8+ T cell function to fight cancer. Here, IL21 is linked to cancer.