This paper presents the evaluation of the Total Harmonic Distortion (THD) of a single phase cascaded multilevel inverter optimized using the technique of Particle Swarm Optimization (PSO). The aim of this work is to improve the harmonic content of the inverter voltage output signal. The inverter operating parameters have been changed in terms of number of stages, the voltage in the sources and the switching pattern in order to find a minimal configuration that satisfies a THD below 5%, using the fewest semiconductors possible.