Epidemiological studies of statin use and liver cancer risk have produced conflicting results. We examined the association between statin use and risk of primary liver cancer in two large independent study populations taking account of important covariates and main indications of statins such as high cholesterol and chronic liver disease. We performed a nested case-control study within the Scottish Primary Care Clinical Informatics Unit (PCCIU) database. Five controls were matched to cases with primary liver cancer and we used conditional logistic regression to calculate odds ratios (ORs) and 95% confidence intervals (CIs) for associations with statin use. We also conducted a prospective cohort study within the UK Biobank using self-reported statin use and cancer-registry recorded primary liver cancer outcomes. Cox regression was used to calculate hazard ratios (HRs) and 95% CIs. In the PCCIU case-control analysis, 434 liver cancer cases were matched to 2,103 controls. In the UK Biobank cohort, 182 out of 475,768 participants developed incident liver cancer. Statin use was associated with 39% lower risk of liver cancer in the PCCIU (adjusted OR 0.61, 95% CI 0.43-0.87). When we examined specific subtypes of liver cancer in the UK Biobank, statin use was associated with lower risk of hepatocellular carcinoma (HCC) (adjusted HR, 0.48; 95% CI, 0.24-0.94) but not intrahepatic bile duct carcinoma (IBDC) (adjusted HR, 1.09; 95% CI, 0.45-2.64). In conclusion, we found a consistent inverse relationship between statin use and risk of primary liver cancer which was only seen for HCC but not IBDC. This article is protected by copyright. All rights reserved.