In this present work, nitrogen and sulfur co-doped carbon dots (NSCDs) were prepared from thiomalic acid as the carbon and sulfur source and NSCDs were used conveniently and sensitively to monitor Hg2+ and glutathione, regarding as a switching mode (turn-on-off) fluorescent sensing probe. The constructed NSCDs were characterized with their morphology and surface functional groups by TEM, XPS and XRD. The average particle size of the as-synthesized NSCDs is 4.4 nm. The fluorescence of NSCDs was efficiently quenched by Hg2+ with excitation and emission wavelength at 380/568 nm, respectively. The sensitive detection method of Hg2+ was established in 0.00–32.0 μM concentration range. The quenched fluorescence of NSCDs@Hg2+ could be recovered after adding GSH. As a result, the concentration of GSH at 0.50–34.0 μM could linearly relate to the change in fluorescence of NSCDs@Hg2+. The Hg2+ and GSH in human urine and serum samples were detected with the recoveries of 98.5%–104.5 and 98.5–103.5%, respectively. Owing to NSCDs favorable biocompatibility and low cytotoxicity, they were successfully applied to detect Hg2+ and GSH in HepG2 cells, indicating that NSCDs have potential applications in biology.