One of the effective ways of reducing power system losses is local compensation of part of the reactive power consumption by deploying shunt capacitor banks. Since the capacitor’s impedance is frequency-dependent and it is possible to generate resonances at harmonic frequencies, it is important to provide an efficient method for the placement of capacitor banks in the presence of nonlinear loads which are the main cause of harmonic generation. This paper proposes a solution for a multi-objective optimization problem to address the optimal placement of capacitor banks in the presence of nonlinear loads, and it establishes a reasonable reconciliation between costs, along with improvement of harmonic distortion and a voltage index. In this paper, while using the harmonic power flow method to calculate the electrical quantities of the grid in terms of harmonic effects, the non-dominated sorting genetic (NSGA)-II multi-objective genetic optimization algorithm was used to obtain a set of solutions named the Pareto front for the problem. To evaluate the effectiveness of the proposed method, the problem was tested for an IEEE 18-bus system. The results were compared with the methods used in eight other studies. The simulation results show the considerable efficiency and superiority of the proposed flexible method over other methods.