Innovative nitrogen and boron co-doped carbon dots are hydrothermally produced using fructose, urea, and boric acid as precursors. The synthesized carbon dots possess a uniform morphology, and exhibit excellent fluorescence stability, tunable luminescence property, strong resistance to photobleaching, low-toxicity, and excellent biocompatibility. It is also found more dopant urea is conducive to the formation of the carbon dots with more B-N bonds, and shorter wavelength of fluorescence emission. Meanwhile, the synthesized carbon dots are well utilized as a photoluminescent probe for facile Hg2+ determination and fluorescent imaging reagent in cells.