As the application of image process extends to each emerging field, high-performance salt-and-pepper denoising is still a challenging task. Therefore, a salt-and-pepper denoising method combining training of noise mask and nearest searching mechanism is proposed. Firstly, a lightweight neural network with 9 convolutional layers is constructed to generate a high-quality noise mask. Subsequently, according to the marking result of this mask, the normal pixel is not processed, while gray level of the noise pixel is replaced by that of the nearest normal pixels, which is found by using the nearest searching mechanism. In this paper, a lightweight convolutional neural network for noise labeling is proposed. While reducing the network depth, the conventional convolution for the middle layer is replaced by depth-separable convolution. These two factors reduce computational complexity and parameters number by orders of magnitude. And a denoising method based on the nearest searching mechanism is proposed, which will improve the denoising performance. The pixel units marked as normal points are not processed, and only noise points are processed. Experimental results show that the computational complexity of the proposed network is orders of magnitude lower than that of traditional networks, the misjudging rate for the trained noise mask is 94.79%, 94.79% and 83.65% lower than that of the extreme marking, the extreme image block marking and the average marking, respectively. In addition, PSNR of image processed by the proposed method is 2.53% higher than traditional CNN method, and MSE is 6.76% lower. A lightweight convolutional neural network is applied to salt and pepper denoising for the first time, which reduces network complexity and improves denoising performance.