This paper proposes the Levenberg-Marquardt algorithm to solve the problem of a big error while matching the measurement profile with the template profile. In order to achieve more accurate matching result, error function of the two profiles should be structured firstly. And the next step is optimizing the parameters of transform matrix of error function. To be specific, the error is about the corresponding point distance, and optimization parameters are the rotation variables and the translation variables of the transformation matrix. The experimental result of the system shows that using the method of template matching for profile measurement based on Levenberg-Marquardt algorithm is feasible.