In this work, a highly selective and sensitive method has been developed for the detection of trinitrophenol (TNP), which is a dangerous explosive. For this purpose, N and P co-doped carbon dots (NP-Cdots) have been used. Synthesis of N and P co-doped carbon dots has been carried out by a simple and quick method. X-ray photoelectron spectroscopy analysis was carried out to detect the doping of N and P. These carbon dots are insoluble in water (inNP-Cdots). These carbon dots were functionalized by treating them with conc. HNO 3 so that they become water-soluble (wsNP-Cdots). These dots were characterized by different analytical techniques such as IR, UV–vis, and fluorescence spectroscopy. The as-prepared wsNP-Cdots have good fluorescence properties. The average diameter of wsNP-Cdots is found to be 5.7 nm with an interlayer spacing ( d-spacing) of 0.16 nm. The as-prepared wsNP-Cdots are highly sensitive and selective toward TNP, as observed using a fluorescence quenching technique. The quenching constant for TNP is found to be very high (8.06 × 10 4 M –1), which indicates its high quenching ability. The limit of detection is found to be 23 μM.