The aim of this article is the application of a new Metaheuristic algorithm (Firefly Algorithm) for solving a nonlinear algebraic system where the resolution is needed to study the Selective Harmonic Eliminated PWM strategy (SHEPWM); this strategy is applied to multilevel inverters. The Firefly Algorithm (FA), proposed by Xin-She Yang at the University of Cambridge, is a new Metaheuristic algorithm, which is inspired by the behavior of fireflies is one of the latest Metaheuristics inspired from nature. The principle of the SHEPWM strategy is to impose the voltage pulses and calculate the switching angles to eliminate the selected harmonic orders by solving a nonlinear equations by applying Firefly Algorithm by using a software calculation and plot the shape of the angles calculated based modulation rate where the spectre of voltage shows that the amplitudes of the selected harmonics are zero.