In this article, the authors propose an adaptive frequency median filter (AFMF) to remove the salt and pepper noise. AFMF uses the same adaptive condition of adaptive median filter (AMF). However, AFMF employs frequency median to restore grey values of the corrupted pixels instead of the median of AMF. The frequency median can exclude noisy pixels from evaluating a grey value of the centre pixel of the considered window, and it focuses on the uniqueness of grey values. Hence, the frequency median produces a grey value closer to the original grey value than the one by the median of AMF. Therefore, AFMF outperforms AMF. In experiments, the authors tested the proposed method on a variety of natural images of the MATLAB library, as well as the TESTIMAGES data set. Additionally, they also compared the denoising results of AFMF to the ones of other state-of-the-art denoising methods. The results showed that AFMF denoises more effectively than other methods.