The study aimed to determine adjusted all-cause mortality and cause of death in persons with chronic hepatitis B virus (HBV) infection compared with age- and sex-matched persons from the general population. We used nationwide registers to identify persons aged ≥18 years with chronic HBV infection in 2002–2017 in Denmark and included 10 age- and sex-matched controls for each. Follow-up was from 6 months after diagnosis until death, emigration, or 31 December 2017. Mortality rate ratios (MRRs) adjusted for age, sex, employment, origin and comorbidity were calculated using Poisson regression. Unadjusted cause-specific mortality rate ratios with 95% confidence intervals were calculated assuming a Poisson distribution. A total of 6988 persons with chronic HBV infection and 69,847 controls were included. During a median follow-up of 7.7 years (range 0.0–15.5), 315 (5%) persons with—and 1525 (2%) without—chronic HBV infection died. The adjusted all-cause MRR was 1.5 (95% CI 1.2–2.0). Persons with chronic HBV infection had increased mortality due to liver disease including hepatocellular carcinoma (MRR 12.3 [8.6–17.7]), external causes (MRR 3.3 [2.5–4.7]), endocrine disease (MRR 3.2 [1.8–5.4]), genitourinary disease (MRR 3.2 [1.2–7.6]) and neoplasms (except hepatocellular carcinoma; MRR 1.6 [1.2–2.0]). In conclusion, this study showed an increased all-cause mortality in persons with chronic HBV infection in comparison with age- and sex-matched persons without chronic HBV infection which remained after adjustment for several confounding factors. Excess mortality was mainly associated with liver disease, but also external factors, endocrine disease, genitourinary disease and neoplasms (excluding hepatocellular carcinoma).