Hepatocellular carcinoma (HCC) is a chronic liver disease characterized by persistent tumor growth, contributing significantly to mortality rates worldwide and presenting a growing global health concern. Consequently, there is an urgent need to develop effective diagnostic and treatment strategies for HCC. This study aims to identify crucial genes for early HCC diagnosis to mitigate disease progression and to investigate differences in immune cell infiltration between early-stage and late-stage HCC. We integrated two published datasets for a comprehensive analysis, identifying 575 DEGs subjected to GSEA to reveal pathways distinguishing early-stage from late-stage HCC. Notably, the gene SLC6A8 emerged as a potential diagnostic biomarker for late-stage HCC through LASSO, SVM-RFE and RF-Boruta analyses. ROC curves for SLC6A8 were utilized to evaluate diagnostic accuracy. The ImmuCellAI algorithm assessed immune cell composition differences between early and late-stage HCC, revealing that SLC6A8 expression positively correlates with resting Tfh cells and Th2, while negatively correlating with B cells, indicating its association with immune cell infiltration patterns. To strengthen our results, we further analyzed SLC6A8 expression using single-cell transcriptome data, confirming significant upregulation in late-stage HCC, particularly in key liver cell types such as Hepatocyte cells. Overall, our study identifies SLC6A8 as a potential marker gene that enhances understanding of HCC diagnosis and therapeutic strategies.