This paper proposes an edge preserving filter for removal of impulse noise. Digital images received from various sources are often degraded due to impulse noise and thus become unsuitable for further processing. To overcome this degradation removal of impulse noise is very important. In this paper an effective and efficient method of impulse noise removal is proposed which not only removes noise but also preserves edges. The algorithm first finds noisy, noise free and edge pixels. Then it replaces the noisy pixel with a pixel from its neighbourhood which is nearest to the adaptive median of the noisy pixel, this removes the noise as well as preserves edges and fine image details.