Backgrounds: Hepatocellular carcinoma (HCC) is a malignant cancer with high mortality. Previous studies have reported that RAB42 is associated with prognosis and progression in glioma. However, the role of RAB42 in HCC is still unknown. Therefore, we aimed to elucidate the value of RAB42 in the predicting prognosis of HCC, and its relationship with immune cells infiltration.Methods: UALCAN, HCCDB, and MethSurv databases were used to examine the expression and methylation levels of RAB42 in HCC and normal samples. cBioPortal and MethSurv were used to identify genetic alterations and DNA methylation of RAB42, and their effect on prognosis. The correlations between RAB42 and the immune cells and cancer-associated fibroblasts infiltration were analyzed by TIMER, TISIDB, and GEPIA database. The LinkedOmics database was used to analyze the enriched pathways associated with genes co-expressed with RAB42. EdU assay was used to evaluate the proliferation ability of liver cancer cells, and transwell assay was used to detect the invasion and migration ability of liver cancer cells.Results: The expression levels of RAB42 were increased in HCC tissues than that in normal tissues. Highly expressed RAB42 was significantly correlated with several clinical parameters of HCC patients. Moreover, increased RAB42 expression clearly predicted poor prognosis in HCC. Furthermore, multivariate Cox regression analysis showed that RAB42 was an independent prognostic factor in HCC. The RAB42 genetic alteration rate was 5%. RAB42 DNA methylation in HCC tissues was lower than that in normal tissues. Among the 7 DNA methylation CpG sites, two were related to the prognosis of HCC. The results of gene set enrichment analysis (GSEA) showed that RAB42 was associated with various immune cells and cancer-associated fibroblasts infiltration in HCC. Meanwhile, we found RAB42 methylation was strongly correlated with immune infiltration levels, immunomodulators, and chemokines. Experiments in vitro indicated that knockdown of RAB42 inhibited the proliferation, invasion, and migration of liver cancer cells.Conclusions: Our study highlights the clinical importance of RAB42 in HCC and explores the effect of RAB42 on immune infiltration in the tumor microenvironment, and RAB42 may act as a pro-oncogene that promotes HCC progression.