With the increasing integration of renewable energy sources into distribution and transmission networks, the efficiency of cascade H-bridge multilevel inverters (MLIs) in power control applications has become increasingly significant for sustainable electricity generation. Traditionally, obtaining optimal switching angles of MLIs to minimize total harmonic distortion (THD) requires solving the selective harmonic elimination equations. To this end, this research aims to use two recently developed intelligent optimization algorithms, dandelion optimizer and gold rush optimizer, to solve this problem. To evaluate the effectiveness of the proposed algorithms, an eleven-level cascaded H-bridge MLI (CHB-MLI) was considered in the study. Simulation results for different modulation indices were obtained, and the accuracy and solution quality were compared with genetic algorithm and particle swarm optimization algorithms. MATLAB/Simulink-based models were used to verify numerical computations, ensuring the reliability of the findings. This research contributes to the field by providing insights into obtaining optimal switching angles and minimizing THD in MLIs by applying intelligent optimization algorithms.