The traditional intelligent algorithms for the selected harmonic elimination pulse-width modulation (SHEPWM) of multilevel converters provide low convergent rate and low accuracy of solutions when solving quarter-wave symmetry nonlinear equations. To obviate this problem and obtain a better modulating performance, an improved imperialist competition algorithm is proposed. The proposed algorithm enhances the global search ability by using moving imperialists. Also, a novel type of particles, named independent countries, are proposed to help the algorithm jump out of the local optimum. These independent countries change their positions using swarm intelligence. Compared with the existing particle swarm algorithm and genetic algorithm, the proposed algorithm has significant advantages by improving the accuracy of solutions and the rate of convergence. Finally, the correctness and effectiveness of the proposed algorithm are verified and evaluated by simulation and experimental results.