The problem of optimization the modes of electrical networks pro- vides determination the optimal values of reactive power of sources, voltages of reference nodes and transformation ratios of controlled transformers. At pre- sent, methods and algorithms for optimization of reactive power and node volt- ages are sufficiently developed. However, the development of new efficient optimization algorithms of transformation ratios remains as a important topic. In this case, the issues of optimization of transformation ratios of transformers included in closed networks have a particular importance. This paper provides an effective algorithm for optimization the modes of electrical networks on transformation ratios of controlled transformers. The results of research of its efficiency in the presence of transformers with phase-rotary and longitudinal control in the circuit are presented. It is shown that minimization of losses in closed electrical networks when optimizing transformation ratios occurs due to the rational distribution of power flows in the branches.