In this paper, a new nature-inspired human-based optimization algorithm is proposed which is called coronavirus herd immunity optimizer (CHIO). The inspiration of CHIO is originated from the herd immunity concept as a way to tackle coronavirus pandemic (COVID-19). The speed of spreading coronavirus infection depends on how the infected individuals directly contact with other society members. In order to protect other members of society from the disease, social distancing is suggested by health experts. Herd immunity is a state the population reaches when most of the population is immune which results in the prevention of disease transmission. These concepts are modeled in terms of optimization concepts. CHIO mimics the herd immunity strategy as well as the social distancing concepts. Three types of individual cases are utilized for herd immunity: susceptible, infected, and immuned. This is to determine how the newly generated solution updates its genes with social distancing strategies. CHIO is evaluated using 23 well-known benchmark functions. Initially, the sensitivity of CHIO to its parameters is studied. Thereafter, the comparative evaluation against seven state-of-the-art methods is conducted. The comparative analysis verifies that CHIO is able to yield very competitive results compared to those obtained by other well-established methods. For more validations, three real-world engineering optimization problems extracted from IEEE-CEC 2011 are used. Again, CHIO is proved to be efficient. In conclusion, CHIO is a very powerful optimization algorithm that can be used to tackle many optimization problems across a wide variety of optimization domains.