Hepatitis B and C viruses are a global health problem causing acute and chronic infections that can lead to liver cirrhosis and hepatocellular carcinoma (HCC). These infections are the leading cause for HCC worldwide and are associated with significant mortality, accounting for more than 1.3 million deaths per year. Owing to its high incidence and resistance to treatment, liver cancer is the second leading cause of cancer-related death worldwide, with HCC representing approximately 90% of all primary liver cancer cases. The majority of viral-associated HCC cases develop in subjects with liver cirrhosis; however, hepatitis B virus infection can promote HCC development without prior end-stage liver disease. Thus, understanding the role of hepatitis B and C viral infections in HCC development is essential for the future design of treatments and therapies for this cancer. In this review, we summarize the current knowledge on hepatitis B and C virus hepatocarcinogenesis and highlight direct and indirect risk factors. This article is part of the themed issue 'Human oncogenic viruses'.