As a tumor suppressor, p16 can competitively block the cyclin D1-CDK4/6 complex to arrest the cell cycle in the G1 phase. Lack of p16 gene expression can lead to infinite cell proliferation and malignant transformation. To determine whether the hepatitis B virus X protein (HBx) regulates the methylation and expression of the p16 gene. We constructed a eukaryotic expression vector carrying the HBx gene and green fluorescent protein (GFP), and transfected it into HepG2 cells to build cell lines stably expressing GFP and GFP-HBx. The p16 protein level and p16 gene methylation were measured in these cell lines. We further detected the mRNA expression of DNA methyltransferases (DNMTs) 1, 3A and 3B. The DNMT1, DNMT3A and DNMT3B gene promoter sequences were inserted into a reporter vector (pGL3-Basic) to build recombinant vectors, which were then transiently transfected into different cell lines. After 48 h, the luciferase activity was measured. The level of p16 protein in GFP-HBx/HepG2 cells was significantly lower than in HepG2 and GFP/HepG2 cells. The CpG methylation was present in the p16 gene promoter region of GFP-HBx/HepG2 cells. The DNMT1 and DNMT3A mRNA levels in GFP-HBx/HepG2 cells were significantly elevated compared to that in the HepG2 cells (p = 0.0495). The luciferase activity in GFP-HBx/HepG2 cells transfected with the pGL3-DNMT1/3A pro plasmid was significantly higher than in HepG2 and GFP/HepG2 cells (both p < 0.05). The HBx can induce p16 gene promoter methylation and inhibit the expression of p16 in HepG2 cells. This occurs due to HBx activation of DNMT1 and DNMT3A promoters and the induction of p16 promoter methylation, which downregulates the expression of p16 protein.