The incidence, risk factors, and clinical features of hepatocellular carcinoma (HCC) in primary biliary cirrhosis (PBC) have been a long-standing subject of interest. We took advantage of a large cohort of 1865 well-defined Chinese patients with PBC for whom follow-up was conducted for up to 20 years to study the incidence of HCC. Our goal was to address the incidence and prevalence of HCC in PBC and the risk factors, including hepatitis B virus (HBV) infection, and finally to compare the tumor characteristics of PBC-related HCC, including size, location, mortality, and long-term outcomes, to that of HBV-related HCC. In this cohort, HCC occurred in 70 of 1865 PBC patients with a prevalence of 3.75 % and an incidence of 0.66 cases per 100 patient-years. The 5- and 10-year cumulative incidences were 2.6 % (95 % confidence interval (CI) 1.8-3.4) and 8.9 % (95 % CI 5.5-12.3), respectively. Age >54 years (odds ratio [OR] = 5.5, 95 % CI 3.0-10.1, p = 0.001), male sex (OR = 2.2, 95 % CI 1.2-4.0, p = 0.001), co-existence of diabetes mellitus (DM) (OR = 3.1, 95 % CI 1.6-6.2, p = 0.002), and previous HBV infection (OR = 6.6, 95 % CI 3.7-11.9, p = 0.001) were independently associated with the development of HCC. The tumor size, number, location, and 5-year survival were not significantly different in PBC-related HCC compared to HBV-related HCC. Alpha-fetoprotein was elevated in only 20 % of the cases with PBC-related HCC. Although HCC was uncommon, occurring in fewer than 5 % of patients, the risk is significantly increased by age, sex, DM, and past HBV infection.