The aim of the present study was to investigate the role of interleukin (IL)-21 in chronic hepatitis B virus (HBV) infection. IL-21 stimulates T and B cell responses and plays a role in the control of chronic viral infections. Serum IL-21 levels were measured by enzyme immunoassay in 109 patients with chronic HBV infection at various clinical stages, as well as in 19 healthy controls (HCs). The proportion of T cells producing IL-21 in the peripheral blood was assessed by intracellular cytokine staining and flow cytometry. Mean serum IL-21 levels in patients with chronic hepatitis B (CHB) and the HCs were 303.54±152.77 pg/ml and 68.24±9.06 pg/ml, respectively (P=0.003). In addition, the mean serum IL-21 level in patients with hepatitis B-related acute-on-chronic liver failure (HB-ACLF) was 455.38±412.38 pg/ml, which exhibited a statistically significant difference when compared with the HCs (P=0.000). Serum IL-21 levels were highest in the patients with HB-ACLF (455.38±412.38 pg/ml) and exhibited a significant difference when compared with the CHB patients (P=0.04). The mean serum IL-21 levels in patients with cirrhosis also increased, but there was no statistically significant difference when compared with the HCs (P=0.82). The frequency of IL-21+CD4+ cells also increased compared with the HCs and correlated with the number and percentage of lymphocytes in the peripheral blood. Serum IL-21 levels increased in CHB and HB-ACLF patients. Relatively low serum IL-21 levels in CHB may have a causal role in the persistence of HBV infection. Higher serum levels in HB-ACLF may activate T and B cells to eliminate the virus or injure the liver via the release of inflammatory cytokines.