A packaging machine for real-time alignment of packaging surfaces can include two or more sensors for detecting the position of carton surfaces and a servo system, including a servo motor and a controller. The servo system records the positioning of the carton surfaces and calculates a difference in position. The controller compares the calculated value with a predetermined value, and if necessary, the servo motor turns a correction wheel to align the carton surfaces.