Background: Hepatitis B-related liver cirrhosis (HBV-LC) is a common clinical disease that evolves from chronic hepatitis B (CHB). The development of cirrhosis can be suppressed by pharmacological treatment. When CHB progresses to HBV-LC, the patient’s quality of life decreases dramatically and drug therapy is ineffective. Liver transplantation is the most effective treatment, but the lack of donor required for transplantation, the high cost of the procedure and post-transplant rejection make this method unsuitable for most patients.Methods: The aim of this study was to find potential diagnostic biomarkers associated with HBV-LC by bioinformatics analysis and to classify HBV-LC into specific subtypes by consensus clustering. This will provide a new perspective for early diagnosis, clinical treatment and prevention of HCC in HBV-LC patients. Two study-relevant datasets, GSE114783 and GSE84044, were retrieved from the GEO database. We screened HBV-LC for feature genes using differential analysis, weighted gene co-expression network analysis (WGCNA), and three machine learning algorithms including least absolute shrinkage and selection operator (LASSO), support vector machine recursive feature elimination (SVM-RFE), and random forest (RF) for a total of five methods. After that, we constructed an artificial neural network (ANN) model. A cohort consisting of GSE123932, GSE121248 and GSE119322 was used for external validation. To better predict the risk of HBV-LC development, we also built a nomogram model. And multiple enrichment analyses of genes and samples were performed to understand the biological processes in which they were significantly enriched. And the different subtypes of HBV-LC were analyzed using the Immune infiltration approach.Results: Using the data downloaded from GEO, we developed an ANN model and nomogram based on six feature genes. And consensus clustering of HBV-LC classified them into two subtypes, C1 and C2, and it was hypothesized that patients with subtype C2 might have milder clinical symptoms by immune infiltration analysis.Conclusion: The ANN model and column line graphs constructed with six feature genes showed excellent predictive power, providing a new perspective for early diagnosis and possible treatment of HBV-LC. The delineation of HBV-LC subtypes will facilitate the development of future clinical treatment of HBV-LC.