As an antibiotic, the imbalance of the concentration of doxycycline hydrochloride (DOX) can cause many harms, so real-time detection of the DOX content is crucial. In this study, Galla chinensis residue (GCR) was used as a carbon source, m-phenylenediamine was used as an N-doping agent, and blue-green fluorescent carbon dots (N-GCRCDs) were prepared by a simple hydrothermal synthesis method, with a high quantum yield of 27.31 %. Under optimized conditions, a specific fluorescent probe was established to detect DOX. The addition of DOX resulted in a significant decrease in fluorescence intensity, with a detection range of 5.7–114.9 μM and the detection limit was 1.38 μM. Finally, the feasibility of this method was validated in human urine and the experimental results exhibited a DOX recovery rate of 97.45–104.41 % and an RSD of 0.91–2.64 %. The quenching mechanism was mainly attributed to the inner filter effect and static quenching. Furthermore, the potential application of N-GCRCDs in cells was studied and biocompatibility was evaluated using HepG2 cells, which showed low toxicity at concentrations of 0–50 μg/mL and successful application for HepG2 cell imaging. This study provides reference for resource utilization of GCR and quantitative detection of antibiotics.