The presence of random noise tends to affect the accuracy of the image analysis. To improve the quality of seismic data, this paper puts up a new algorithm of random noise with seismic data based on nonlocal means. This algorithm denoises each sample or pixel within an image by utilizing other similar samples or pixels regardless of their spatial proximity, making the process nonlocal. Filtering parameter h is importance for denoising random noise. Combined with examples, the seismic data are analyzed. The results indicate that the tests with synthetic and real data sets demonstrate that the nonlocal means algorithm does not smear seismic energy across sharp discontinuities or curved events when compared to traditional methods such as median filter, Gaussian filter, which shows that the nonlocal means algorithm is a practical and effective method.