Acute-on-chronic liver failure (ACLF) is a syndrome with high short-term mortality. Precipitating events, including hemorrhage and infections, contribute to ACLF development, but the role of surgery remains unknown. We investigated the development of ACLF in patients with cirrhosis undergoing surgery. In total, 369 patients with cirrhosis were included in the study. The clinical and laboratory data were collected prior to and on days 1-2, 3-8, and 9-28, and at 3 and 12 months after surgery. Surgery type was classified as limited or extensive, as well as liver and nonliver surgery. A total of 39 patients had baseline ACLF. Surgery was performed during acute decompensation in 35% of the rest of the 330 patients, and 81 (24.5%) developed ACLF within 28 days after surgery. Surrogate markers of systemic inflammation were similar in patients who developed ACLF or not. Age, sex, serum sodium, baseline bacterial infection, and abdominal nonliver surgery were independent predictors for the development of ACLF after surgery. Patients who developed ACLF within 28 days after surgery had a higher mortality at 3, 6, and 12 months. Survival did not differ between patients with ACLF at surgery and those developing ACLF after surgery. Development of ACLF within 28 days after surgery and elevated alkaline phosphatase and international normalized ratio were independent predictors of 90-day mortality. Independent predictors of 1-year all-cause mortality were alkaline phosphatase, Model for End-Stage Liver Disease score, and preoperative hepatic encephalopathy, whereas nonliver surgery was associated with improved survival. ACLF frequently develops in patients with cirrhosis undergoing surgery, especially in those with active bacterial infection, lower serum sodium, and kidney or coagulation dysfunction. Prognoses of ACLF both at and after surgery are similarly poor. Patients with cirrhosis should be carefully managed perioperatively.