Current immunotherapies yield remarkable clinical outcomes by boosting the power of host immunity in cancer cell elimination and viral clearance. However, after prolonged antigen exposure, CD8+ T cells differentiate into a special differentiation state known as T-cell exhaustion, which poses one of the major hurdles to antiviral and antitumor immunity during chronic viral infection and tumour development. Growing evidence indicates that exhausted T cells undergo metabolic insufficiency with altered signalling cascades and epigenetic landscapes, which dampen effector immunity and cause poor responsiveness to immune-checkpoint-blockade therapies. How metabolic stress affects T-cell exhaustion remains unclear; therefore, in this Review, we summarize current knowledge of how T-cell exhaustion occurs, and discuss how metabolic insufficiency and prolonged stress responses may affect signalling cascades and epigenetic reprogramming, thus locking T cells into an exhausted state via specialized differentiation programming.