Purpose: The present study was conducted to evaluate the use of computer-aided facial expression analysis to assess postoperative pain in children. Design and methods: This was a methodological observational study. The study population consisted of patients in the age group of 7–18 years who underwent surgery in the pediatric surgery clinic of a university hospital. The study sample consisted of 83 children who agreed to participate and met the sample selection criteria. Data were collected by the researcher using the Wong Baker Faces pain rating scale and Visual Analog Scale. Data were collected from the child, mother, nurse, and one external observer. Facial action units associated with pain were used for machine estimation. OpenFace was used to analyze the child's facial action units and Python was used for machine learning algorithms. The intraclass correlation coefficient was used for statistical analysis of the data. Results: The pain score predicted by the machine and the pain score assessments of the child, mother, nurse, and observer were compared. The pain assessment closest to the self-reported pain score by the child was in the order of machine prediction, mother, and nurse. Conclusions: The machine learning method used in pain assessment in children performed well in estimating pain severity.It can code facial expressions of children's pain and reliably measure pain-related facial action units from video recordings. Application to practice: The machine learning method for facial expression analysis assessed in this study can potentially be used as a scalable, standard, and valid pain assessment method for nurses in clinical practice.