Currently, the fluorescent probe is an important method for detecting heavy metal ions, especially mercury ion (Hg ), which is harmful to the health of humans and the environment due to its toxicity and extensive use. In this paper, we designed and synthesized a colorimetric and long-wavelength fluorescent probe Hg-P with high sensitivity and excellent selectivity, which could detect Hg by the changes of visual color, fluorescence and absorption spectroscopy. With the addition of Hg to probe Hg-P solution, its color changed from yellow to pink, and showed a 171 nm red-shifted absorption spectrum. Probe Hg-P was used in real water and soil solution samples to detect Hg , and the result is satisfactory. Therefore, this new probe shows great value and application in detecting Hg in the environment.