Due to the high mortality of hepatocellular carcinoma (HCC), its prognostic models are urgently needed. Bile acid (BA) metabolic disturbance participates in hepatocarcinogenesis. We aim to develop a BA-related gene signature for HCC patients. Research data of HCC were obtained from The Cancer Genome Atlas (TCGA) and International Cancer Genome Consortium (ICGC) online databases. After least absolute shrinkage and selection operator (LASSO) regression analysis, we developed a BA-related prognostic signature in TCGA cohort based on differentially expressed prognostic BA-related genes. Then, the predictive performance of the signature was evaluated and verified in TCGA and ICGC cohort respectively. We obtained the risk score of each HCC patient according to the model. The differences of immune status and drug sensitivity were compared in patients that were stratified based on risk score. The protein and mRNA levels of the modeling genes were validated in the Human Protein Atlas database and our cell lines, respectively. In TCGA cohort, we selected 4 BA-related genes to construct the first BA-related prognostic signature. The risk signature exhibited good discrimination and predictive ability, which was verified in ICGC cohort. Patients were classified into high- and low-risk groups according to their median scores. The occurrence of death increased with increasing risk score. Low-risk patients owned favorable overall survival. High-risk patients possessed high immune checkpoint expression and low IC50 values for sorafenib, cisplatin and doxorubicin. Real-time quantitative PCR and immunohistochemical results validate expression of modeling genes in the signature. We constructed the first BA-related gene signature, which might help to identify HCC patients with poor prognosis and guide individualized treatment.