Background & Aims Genetic variability in the hepatitis B virus X gene (HBx) is frequently observed and is associated with hepatocellular carcinoma (HCC) progression. However, a genotype classification based on the full-length HBx sequence and the impact of genotypes on hepatitis B virus (HBV)-related HCC prognosis remain unclear. We therefore aimed to perform this genotype classification and assess its clinical impact. Methods We classified the genotypes of the full-length HBx gene through sequencing and a cluster analysis of HBx DNA from a cohort of patients with HBV-related HCC, which served as the primary cohort (n = 284). Two independent HBV-related HCC cohorts, a validation cohort (n = 171) and a serum cohort (n = 168), were used to verify the results. Protein microarray assay analysis was performed to explore the underlying mechanism. Results In the primary cohort, the HBx DNA was classified into 3 genotypes: HBx-EHBH1, HBx-EHBH2, and HBx-EHBH3. HBx-EHBH2 (HBx-E2) indicated better recurrence-free survival and overall survival for patients with HCC. HBx-E2 was significantly correlated with the absence of liver cirrhosis, a small tumor size, a solitary tumor, complete encapsulation and Barcelona Clinic Liver Cancer (BCLC) stage A-0 tumors. Additionally, HBx-E2 served as a significant prognostic factor for patients with BCLC stage B HCC after hepatectomy. Mechanistically, HBx-E2 is unable to promote proliferation in HCC cells and normal hepatocytes. It also fails to activate the Janus kinase 1 (JAK1)/signal transducer and activator of transcription 3 (STAT3)/STAT5 pathway. Conclusion Our study identifies a novel HBx genotype that is unable to promote the proliferation of HCC cells and suggests a potential marker to preoperatively predict the prognosis of patients with BCLC stage B, HBV-associated, HCC. Lay summary We classified a novel genotype of the full-length hepatitis B virus X gene (HBx), HBx-E2. This genotype was identified in tumor and nontumor tissues from patients with hepatitis B virus-related hepatocellular carcinoma. HBx-E2 could preoperatively predict the prognosis of patients with intermediate stage hepatocellular carcinoma, after resection.