Purpose In recent years, the development of metaheuristic algorithms for solving optimization problems within a reasonable timeframe has garnered significant attention from the global scientific community. In this work, a new metaheuristic algorithm inspired by the inflection mechanism of the avian influenza virus H5N1 in poultry and humans, taking into account its mutation mechanism, called H5N1. Design/methodology/approach This algorithm aims to explore optimal solutions for optimization problems by simulating the adaptive behavior and evolutionary process of the H5N1 virus, thereby enhancing the algorithm’s performance for all types of optimization problems. Additionally, a balanced stochastic probability mechanism derived from the infection probability is presented. Using this mechanism, the H5N1 algorithm can change its phrase, including exploitation and exploration phases. Two versions of H5N1, SH5N1 and MH5N1, are presented to solve single-objective optimization problems (SOPs) and multi-objective optimization problems (MOPs). Findings The performance of the algorithm is evaluated using a set of benchmark functions, including seven unimodal, six multimodal, ten fixed-dimension multimodal to solve SOPs, ZDT functions and CEC2009 has been used to demonstrate its superiority over other recent algorithms. Finally, six optimization engineering problems have been tested. The results obtained indicate that the proposed algorithm outperformed ten algorithms in SOPs and seven algorithms in MOPs. Originality/value The experimental findings demonstrate the outstanding convergence of the H5N1 algorithm and its ability to generate solutions of superior quality.