AbstractThe application of iterative techniques for solving the Selective Harmonic Elimination Pulse Width Modulation (SHE‐PWM) problem, such as the Newton–Raphson (NR) method, can tend to get stuck at local optima in the solution space. Additionally, these methods may be sensitive to the initial value estimation of the solution. In contrast, metaheuristic approaches demonstrate resilience in seeking out the optimal solution. As such, this study utilizes the Runge–Kutta (RUN) metaheuristic optimization algorithm to demonstrate the SHE‐PWM technique in multilevel inverters (MLIs), including 5‐ and 7‐level modified H‐bridge (MHB) topology and a 9‐level asymmetric cascaded H‐bridge (CHB) inverter topology. The switching angles are obtained by varying the modulation index from 0.01 to 1.0 in steps of 0.01 for 5‐, 7‐, and 9‐level MLIs. The performance of the RUN algorithm in minimizing the total harmonic distortion (THD) value is verified through simulations in MATLAB/Simulink software. The superiority of RUN is established by comparing the results with state‐of‐the‐art metaheuristic algorithms, such as the Differential Evolution (DE), Genetic Algorithm (GA), and Grey Wolf Optimizer (GWO). Additionally, the switching angles obtained through RUN are validated by hardware experiments. According to the simulation and experimental results, the proposed RUN method exhibits better performance in terms of objective function values, algorithm robustness, fundamental harmonic magnitude, and THD values. The findings confirm the elimination of fifth harmonic, fifth, and seventh harmonics, and fifth, seventh, and ninth harmonics in 5‐, 7‐, and 9‐level MLIs, respectively.