Upon stimulation, small numbers of naive CD8+ T cells proliferate and differentiate into a variety of memory and effector cell types. CD8+ T cells can persist for years and kill tumour cells and virally infected cells. The functional and phenotypic changes that occur during CD8+ T cell differentiation are well characterized, but the epigenetic states that underlie these changes are incompletely understood. Here, we review the epigenetic processes that direct CD8+ T cell differentiation and function. We focus on epigenetic modification of DNA and associated histones at genes and their regulatory elements. We also describe structural changes in chromatin organization that affect gene expression. Finally, we examine the translational potential of epigenetic interventions to improve CD8+ T cell function in individuals with chronic infections and cancer.