Abstract In the realm of modern railway maintenance, the employment of large tamping machine for the enhancement of track geometry and elasticity, and the minimization of disturbance to the roadbed, has become a key operational approach. However, factors such as repeated load applications, changes in topography and geology, and ongoing maintenance activities have been known to cause significant deviations of the actual track location from its original design. These deviations present challenges, such as increased construction difficulty and workload, during tamping operations predicated on the original design. Moreover, methods based on manual intervention have rendered large machine maintenance operations inefficient. In this paper, an optimisation method for railway profile parameters suitable for large tamping machine operations is proposed. The method integrates the total least squares method and the direct search method, enabling the accurate fitting of slope segments preceding and following the slope change points and the alignment of circular curve segments to determine the optimal curve radius. Consequently, optimised profile parameters for the continuous track section are obtained. Focusing on the Beijing–Guangzhou line, the operational efficacy of the proposed optimisation method is compared with that of the artificial slope method. The results showed that the proposed optimisation method is not only more accurate and efficient but also adheres to the principle of ‘prefer lifting rather than descending’ of the railways. The method further provides a theoretical basis and practical guidance for the optimisation of railway profile, underscoring the potential for improved maintenance efficiency and enhanced safety in train operations.