Background & Aims: Nivolumab, a programmed death (PD)-1 (PD-1) inhibitor, led to durable responses, manageable safety, and increased survival in patients with advanced hepatocellular carcinoma (HCC). In our retrospective analysis, we studied the immunobiology and potential associations between biomarkers and outcomes with nivolumab in HCC. Methods: Fresh and archival tumour samples from dose-escalation and dose-expansion phases of the CheckMate 040 trial were analysed by immunohistochemistry and RNA sequencing to assess several inflammatory gene expression signatures, including CD274 (PD-ligand 1 [PD-L1]), CD8A, LAG3, and STAT1. Biomarkers were assessed for association with clinical outcomes (best overall response by blinded independent central review per RECIST v1.1 and overall survival [OS]). Results: Complete or partial tumour responses were observed in PD-L1-positive and PD-L1-negative patients treated with nivolumab monotherapy. Median OS was 28.1 (95% CI 18.2-n.a.) vs. 16.6 months (95% CI 14.2-20.2) for patients with tumour PD-L1 >= 1% vs. <1% (p = 0.03). Increased CD3 and CD8 showed a non-significant trend towards improved OS (both p = 0.08), and macrophage markers were not associated with OS. Tumour PD-1 and PD-L1 expression were associated with improved OS (p = 0.05 and p = 0.03, respectively). An inflammatory gene signature consisting of 4 genes was associated with improved objective response rate (p = 0.05) and OS (p = 0.01). Conclusions: PD-1 and PD-L1 expression, biomarkers of inflammation, and inflammatory gene signatures trended with improved survival and response. While further confirmation within a larger phase III trial is needed to evaluate predictive value of these biomarkers, these exploratory analyses suggest that anti-tumour immune response may play a role in the treatment benefit of nivolumab in HCC. Lay summary: Certain tests may be used to provide a picture of how a tumour is escaping the immune system, allowing it to continue to grow and create more tumours. Therapies such as nivolumab are designed to help the immune system fight the tumour. These tests may be used to determine how effective such therapies will be in the treatment of advanced liver cancer. (C) 2020 European Association for the Study of the Liver. Published by Elsevier B.V.