Autofocusing is a fundamental technology for automated biological and biomedical analyses and is indispensable for routine use of microscopes on a large scale. This article presents a comprehensive comparison study of 18 focus algorithms in which a total of 139,000 microscope images were analyzed. Six samples were used with three observation methods (brightfield, phase contrast, and differential interference contrast (DIC)) under two magnifications (100× and 400×). A ranking methodology is proposed, based on which the 18 focus algorithms are ranked. Image preprocessing was also conducted to extensively reveal the performance and robustness of the focus algorithms. The presented guidelines allow for the selection of the optimal focus algorithm for different microscopy applications. Microsc. Res. Tech. 65:139–149, 2004. © 2004 Wiley-Liss, Inc.