A novel carbon quantum dots (CQDs) was successfully prepared through one-step green hydrothermal method using polyacrylamide as carbon source. The prepared CQDs were characterized using TEM, XRD, XPS, FT-IR, UV–Vis, and fluorescence spectroscopy. The CQDs was demonstrated as nanoprobes for mercury ion detection, moreover, it demonstrated excitation-dependent and superior stability in acidic and alkaline media. Besides, the probe exhibited a good linearity range (0.25–50μM) and a low detection limit (13.48nM). These attractive properties indicated that this novel CQDs can adapt to a variety of complex pH environment, which had extensive prospect and promising application for detection of mercury ions in complex water samples.