Traditional cylinder head gasket design is based on the assumption that the mating surfaces’ form is ideal plane. However, high definition metrology (HDM) shows that the top surface of cylinder blocks and the bottom surface of cylinder heads are far from ideal plane and presents a macro form error. To compensate the macro form error of the mating surfaces, a gasket design optimization method is proposed in this paper. It mainly consists of two modules. The first module is surface alignment and gap calculation. Measured surface topography is aligned by control point registration and the control points are found by region labelling algorithm. The second module is gasket design optimization based on surface gap. A case study shows the details of the proposed gasket design optimization method.