We propose an Iterative Mean Filter (IMF) to eliminate the salt-and-pepper noise. IMF uses the mean of gray values of noise-free pixels in a fixed-size window. Unlike other nonlinear filters, IMF does not enlarge the window size. A large size reduces the accuracy of noise removal. Therefore, IMF only uses a window with a size of 3 x 3. This feature is helpful for IMF to be able to more precisely evaluate a new gray value for the center pixel. To process high-density noise effectively, we propose an iterative procedure for IMF. In the experiments, we operationalize Peak Signal-to-Noise Ratio (PSNR), Visual Information Fidelity, Image Enhancement Factor, Structural Similarity (SSIM), and Multiscale Structure Similarity to assess image quality. Furthermore, we compare denoising results of IMF with ones of the other state-of-the-art methods. A comprehensive comparison of execution time is also provided. The qualitative results by PSNR and SSIM showed that IMF outperforms the other methods such as Based-on Pixel Density Filter (BPDF), Decision-Based Algorithm (DBA), Modified Decision-Based Untrimmed Median Filter (MDBUTMF), Noise Adaptive Fuzzy Switching Median Filter (NAFSMF), Adaptive Weighted Mean Filter (AWMF), Different Applied Median Filter (DAMF), Adaptive Type-2 Fuzzy Filter (FDS): for the IMAGESTEST dataset - BPDF (25.36/0.756), DBA (28.72/0.8426), MDBUTMF (25.93/0.8426), NAFSMF (29.32/0.8735), AWMF (32.25/0.9177), DAMF (31.65/0.9154), FDS (27.98/0.8338), and IMF (33.67/0.9252); and for the BSDS dataset - BPDF (24.95/0.7469), DBA (26.84/0.8061), MDBUTMF (26.25/0.7732), NAFSMF (27.26/0.8191), AWMF (28.89/0.8672), DAMF (29.11/0.8667), FDS (26.85/0.8095), and IMF (30.04/0.8753).