The relevance of the work is justified by the need to refine the methodology for calculating cold rolling routes, associated with the expansion of factors that need to be taken into account in conducting such calculations. The aim of the work is to develop an algorithm for optimizing the routes of cold rolling of pipes using CRP and CRPR type mills, convenient for implementation in a software product. The paper analyzes the main parameters for optimizing the routes of cold rolling of pipes, factors limiting the field of optimal values of the geometric parameters of the billet‑pipe in each pass. Among the latter, the maximum possible reduction in the cross‑sectional area, the required reduction in the cross‑sectional area in the last pass, the requirement for the nature of the distribution of the reduction value in the cross‑sectional area, in the wall thickness and in the pipe diameter from pass to pass and other parameters are highlighted. The importance of minimizing the number of passes is noted. The main dependencies included in the method for calculating the deformation parameters of the cold rolling route using CRP and CRPR mills are analyzed and highlighted. An algorithm for calculating the route of cold rolling of pipes, with several iteration operations, has been developed. The proposed algorithm allows optimizing the rolling route of pipes made of any grades of steels and alloys, and allows optimizing most parameters, including those affecting the economic parameters of production. Depending on the grade of steel or alloy, some iteration operations can be excluded. The algorithm has been tested in the practice of calculating rolling routes for pipes made of carbon and stainless steels and alloys.