In summary, we show that Hmgb2 expression is required for the differentiation and survival of memory and Tpex cells during acute and chronic viral infection, respectively. This evidence concerns the gene HMGB2 and viral infectious disease.