An "on-off-on" mode was developed for the detection of mercury ion (Hg2+) and glutathione (GSH) with high sensitivity and selectivity based on the nitrogen-doped carbon dots (N-CDs) fluorescent probe. The N-CDs were synthesized through microwave treatment of citric acid and diethylenetriamine for 2 min, and exhibited excellent fluorescence properties and high quantum yield (27.7%). The fluorescence intensity of the N-CDs could be significantly quenched by Hg2+ (turn-off). Upon addition of GSH, the fluorescence intensity of the N-CDs-Hg2+ system could be recovered clearly (turn-on). The limit of detection of Hg2+ and GSH was 23 and 59 nM, respectively. Moreover, the "on-off-on" probe was successfully applied to the determination of Hg2+ in tap water and water from the Yellow River. Meanwhile, due to bright luminescence, good biocompatibility and low cytotoxicity, the N-CDs-based probe was successfully employed as visualizing the intracellular Hg2+ and GSH sensors in live HeLa cell.