The purpose of this study is to analyze the DNA methylation and gene expression profiles of immune-related CpG sites to identify the molecular subtypes and CpG sites related to the prognosis of HCC. In this study, the DNA methylation and gene expression datasets were downloaded from The Cancer Genome Atlas database, together with immune-related genes downloaded from the immunology database and analysis portal database to explore the prognostic molecular subtypes of HCC. By performing consistent clustering analysis on 830 immune-related CpG sites, we identified seven subgroups with significant differences in overall survival. Finally, 16 classifiers of immune-related CpG sites were constructed and used in the testing set to verify the prognosis of DNA methylation subgroups, and the results were consistent with the training set. Using the TIMER database, we analyzed 16 immune-related CpG sites expression with the abundance of six types of immune infiltrating cells and found that most are positively correlated with the level of infiltration of multiple immune cells in HCC. This study screened potential immune-related prognostic methylation sites and established a new prognosis model of HCC based on DNA methylation molecular subtype, which may help in the early diagnosis of HCC and developing more effective personalized treatments.