Misalignment between the Hartmann–Shack wavefront sensor (HSWFS) and the deformable mirror (DM) will degrade the performance of an adaptive optics (AO) system severely. In this paper, a method of measuring the misalignment between the HSWFS and the DM, which is called the marked actuators of the DM, is presented. The misalignments are divided into different groups and analyzed theoretically. In addition, a 45-element adaptive optics system is constructed to validate the accuracy of the method experimentally. As a consequence, the experimental result agrees well with the theoretical ones.