O-GlcNAcylation is a post-translational modification catalyzed by the enzyme O-GlcNAc transferase, which transfers a single N-acetylglucosamine sugar from UDP-GlcNAc to the protein on serine and threonine residues on proteins. Another enzyme, O-GlcNAcase (OGA), removes this modification. O-GlcNAcylation plays an important role in pathophysiology. Here, we report that O-GlcNAcylation is essential for hepatocyte differentiation, and chronic loss results in fibrosis and HCC. Single-cell RNA-sequencing (RNA-seq) was used to investigate hepatocyte differentiation in hepatocyte-specific O-GlcNAc transferase-knockout (OGT-KO) mice with decreased hepatic O-GlcNAcylation and in O-GlcNAcase-KO mice with increased O-GlcNAcylation in hepatocytes. Patients HCC samples and the diethylnitrosamine-induced HCC model were used to investigate the effect of modulation of O-GlcNAcylation on the development of liver cancer. Loss of hepatic O-GlcNAcylation resulted in disruption of liver zonation. Periportal hepatocytes were the most affected by loss of differentiation, characterized by dysregulation of glycogen storage and glucose production. O-GlcNAc transferase-KO mice exacerbated diethylnitrosamine-induced HCC development with increased inflammation, fibrosis, and YAP signaling. Consistently, O-GlcNAcase -KO mice with increased hepatic O-GlcNAcylation inhibited diethylnitrosamine-induced HCC. A progressive loss of O-GlcNAcylation was observed in patients with HCC. Our study shows that O-GlcNAcylation is a critical regulator of hepatic differentiation, and loss of O-GlcNAcylation promotes hepatocarcinogenesis. These data highlight increasing O-GlcNAcylation as a potential therapy in chronic liver diseases, including HCC.