In this paper, a novel biologically-inspired algorithm, namely krill herd (KH) is proposed for solving optimization tasks. The KH algorithm is based on the simulation of the herding behavior of krill individuals. The minimum distances of each individual krill from food and from highest density of the herd are considered as the objective function for the krill movement. The time-dependent position of the krill individuals is formulated by three main factors: (i) movement induced by the presence of other individuals (ii) foraging activity, and (iii) random diffusion. For more precise modeling of the krill behavior, two adaptive genetic operators are added to the algorithm. The proposed method is verified using several benchmark problems commonly used in the area of optimization. Further, the KH algorithm is compared with eight well-known methods in the literature. The KH algorithm is capable of efficiently solving a wide range of benchmark optimization problems and outperforms the exciting algorithms.