This paper deals with optimal reactive power flow (ORPF) of power systems with two-terminal high voltage direct current (HVDC) and multi distributed generations (DGs) using backtracking search algorithm (BSA). For the first time with this study, the power system is modeled closest to the real world and the power loss of both test systems are minimized by BSA, while DGs and HVDC links are existing simultaneously in the power systems. Although simulations on modified IEEE 30-bus and modified IEEE 57-bus test systems have given successful results by using BSA, genetic algorithm (GA) was also used to compare the outcomes of different algorithms. This study was performed for five and three different cases of the modified 30-bus and modified 57-bus test systems, respectively. The obtained results show that although the power loss does not vary much according to the connection points of HVDC link, the optimal replacement of the DGs to the power system reduces the power loss considerably. In addition to this, when the obtained results are compared with those in the literature, it is seen that the proposed algorithm is better than the other algorithms in terms of performance and effectiveness.