The Simulated Annealing Algorithm is used to solve the problem of optimal placement and sizing of fixed capacitor banks in distribution networks in the presence of harmonic electrical signals. In the mathematical model, the objective function includes the cost of power and energy losses at each harmonic frequency, and the inverting cost of capacitor banks. Constrains include voltage limits, power quality limits, number, size and locations of capacitors banks. A harmonic load flow was implemented as analysis tool.