ObjectiveLiver cancer is one of the most common causes of cancer-related death. Understanding how demographic factors influence mortality due to liver cancer is crucial for optimizing disease-control strategies. We aimed to characterize the long-term trends in the mortality and years of life lost (YLL) of liver cancer in Shanghai, China, 1973–2019, and quantitatively analyze the contributions of demographic and non-demographic factors on the mortality of liver cancer.MethodsUsing mortality data from the Mortality Registration System of Pudong New Area, the largest district of Shanghai with a population of permanent resident of 5.68 million, during 1973–2019, we analyzed the temporal trends for the mortality rates and YLL by Joinpoint Regression Program. The difference decomposition method was employed to estimate the increasing mortality rates related to demographic and non-demographic factors.ResultsA total of 21,530 deaths from liver cancer occurred from 1973 to 2019. The crude mortality rates (CMR) and age-standardized mortality rate by Segi's world standard population (ASMRW) of liver cancer were 26.73/105 person-years and 15.72/105 person-years, respectively. The CMR, ASMRW, and YLL rates of liver cancer showed significantly decreasing trends in males, females and the total population from 1973 to 2019, whereas the upward trends in the YLL were seen in males, females and the total population (all P < 0.05). A significant upward trend was observed in the increased CMR caused by demographic factors, but the changing rate caused by non-demographic factors decreased.ConclusionsThe CMR and ASMRW of liver cancer continually decreased although YLL increased during 1973–2019 in Pudong New Area, Shanghai. The demographic factors, especially aging, might be responsible for the increase in the mortality of liver cancer. More effective prevention strategies tailored to liver cancer are needed to further reduce its disease burden in the elderly population.