A method based on the median filter and gradient technique to detect the small target in infrared image is presented. It firstly uses median filtering to smooth the infrared image, followed by making use of the background subtraction technique to process the original image and the median filtering image. Based upon that, a gradient sharpening method is applied to strengthen the marginal information of the residual image. Finally, a binary technique is utilized to highlight the target. With the complementary effects of the median filter and gradient technique, the infrared dim target can be detected effectively. The results of the simulation have shown the effectivity of the presenting method.