Rapid and reliable detection technologies for mercury ion in cosmetics are critical for public health. In this study, we synthesized nitrogen and zinc doped carbon quantum dots (N, Zn-CDs) with bright and stable fluorescence using the hydrothermal method. Structure characterization reveals the abundant oxygen- and nitrogen-containing functional groups on the surface of N, Zn-CDs, which readily coordinate with Hg2+, resulting in fluorescence quenching. Basing on this, a rapid and simple quantitative analysis method for Hg2+ detection was designed. By optimizing the detection conditions, a good linear relationship in the range of 0 to 10 μM and a low detection limit of 0.023 μM were achieved. Besides, interference tests demonstrate the presence of other metal ions does not interfere with Hg2+ detection. When detecting Hg2+ in four types of cosmetics spiked with the ion, the sensor achieved recovery rates of 98.27 %, 110.03 %, 100.90 %, and 108.80 %, respectively, with relative standard deviations all under 6.90 %, demonstrating its capability to identify Hg2+ in complex matrices. This research offers a novel approach for the rapid and accurate detection of mercury in cosmetics.