Background: Hepatitis B and hepatitis C virus infections are common causes of death related to liver disease. In this large study, we aimed to investigate all cause mortality of the viruses in a community-based setting. Methods: In the study population, 39 109 people had hepatitis B, 75 834 had hepatitis C, and 2604 had hepatitis B and hepatitis C co-infection, notified to the New South Wales state health department, Australia, between 1990 and 2002. Their data were probabilistically linked to the National Death Index. Standardised mortality ratios for all causes of death were calculated and adjusted for age, sex, and calendar year. Results: The number of deaths identified by the linkage were 1233 (3·2%) for hepatitis B, 4008 (5·3)% for hepatitis C, and 186 (7·1)% for hepatitis B and C co-infection. Raised risk of liver-related death (standardised mortality ratios 12·2, 95% CI 10·7-13·9; 16·8, 15·4-18·3, and 32·9, 23·1-46·7, for hepatitis B, hepatitis C, and hepatitis B and C co-infected patients, respectively) and drug-induced death (1·4, 1·0-2·0; 19·3, 18·1-20·5; and 24·7, 18·2-33·5, respectively) were detected. In people with hepatitis C, raised risk of dying from drug-related causes was significantly greater than from liver-related causes (p=0·012), with the greatest excess risk in women aged 15-24 years (56·9, 39·2-79·9). Interpretation: All groups had increased risk of liver-related death compared with the standard population, with the greatest excess in people diagnosed with hepatitis B and hepatitis C co-infection. Our data highlight that young people with hepatitis C and with co-infection face a higher mortality risk from continued drug use than from their infection, whereas the main cause of hepatitis B death was liver related.