| In view of existing serious failures and short service life of rails in the switch area of railway turnouts, based on the wheel-rail contact theory, the method employs the rolling radius difference function and the uniform distribution of the wheel-rail contact points for the primary design objectives. Using the position of the wheel-rail contact points as a boundary condition, the Euler method was adopted to solve the differential equation and obtained the target profile of rail grinding. A computer program based on this method was developed and is validated by way of examples. After the optimization, rail and wheel profiles are better matched, which improves the dynamic performance of rail vehicles crossing turnouts and reduces the wheel-rail contact stress. As a result, the distributions of contact points and wear are more uniform, leading to a prolonged rail service life.