Autofocus systems are essential in optical microscopy. These systems typically sweep the sample through the focal range and apply an algorithm to determine the contrast value of each image, where the highest value indicates the optimal focus position. As the optimal algorithm may vary according to the images' content, we evaluate the 15 most used algorithms in the field using 150 stacks of images from four different kinds of tissue. We use four measuring criteria and two types of analysis and propose a general methodology to apply to select the best fitting algorithm for any given application. In this paper, we present the results of this evaluation and a detailed discussion of different features: the threshold used for the algorithms, the criteria parameters, the analysis used, the bit depth of the images, their magnification, and the type of tissue, reaching the conclusion that some of these parameters are more relevant to the study than others, and the implementation of the proposed methodology can lead to a fast and reliable autofocus system capable of performing an analysis and selection of algorithms with no supervision required.