A selective adaptive median filter is proposed for the restoration of gray scale images that are highly corrupted by salt and pepper noise. In this paper, impulse noise removal using the standard median filter and its variants are analyzed. After detecting the salt and pepper noise pixels, the self-adaptive median filter is use to find a suitable window containing more non-noise pixels. This proposed algorithm provides much better results than that of the standard median filter, weighed median filter and switching mean median filter. The proposed algorithm is tested against different gray scale images and it gives better Peak Signal Noise Ratio (PSNR), Mean Square Error (MSE) and Structural Similarity Index (SSIM).