ObjectiveEnhanced recovery after surgery (ERAS) has significant effects in gastrointestinal surgery, urology, and orthopedic department, but the application of ERAS in liver cancer patients undergoing hepatectomy is less reported. This study aims to identify the effectiveness and safety of ERAS in liver cancer patients undergoing hepatectomy.MethodsPatients who performed ERAS and no-ERAS after hepatectomy due to liver cancer from 2019 to 2022 were prospectively and retrospectively collected, respectively. Preoperative baseline data, surgical characteristics, and postoperative outcomes of patients in ERAS and non-ERAS groups were compared and analyzed. Logistic regression analysis was conducted to identify the risk factors of complications occurrence and prolonged hospital stay.ResultsIn total, 318 patients were included in the study, 150 and 168 individuals in the ERAS group and non-ERAS group, respectively. The preoperative baseline and surgical characteristics between the ERAS and non-ERAS groups were comparable and not statistically different. Postoperative visual analogue scale pain score, the median day of gastrointestinal function recovery postoperative, complications rate, and postoperative hospitalization days were lower in the ERAS group than in the non-ERAS group. In addition, multivariate logistic regression analysis found that the implementation of the ERAS was an independent protective factor for prolonged hospitalization stay and complications occurrence. The rate of rehospitalization after discharge (< 30 days) in the ERAS group was lower than that in the non-ERAS group, but there was no statistical difference between the two groups.ConclusionsThe application of ERAS in hepatectomy for patients with liver cancer is safe and effective.It can accelerate gastrointestinal function recovery postoperative, shorten the length of hospital stay, and reduce postoperative pain and complications.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12893-023-02040-4.