A simple and facile method for sensing of nucleic acids is in great need for disease biomarker detection and diagnosis. Herein, a fluorescent nanosensor utilizing carbon dot nanoparticles is introduced that form visible precipitates in the presence of target DNA. Carbon dot nanoparticles are fabricated by microwave pyrolysis of polyethylenimine, which emits strong photoluminescence and can form precipitates when added to target DNA oligonucleotides. The precipitates can be easily visualized by UV illumination, and data can be acquired as images using a smartphone, which are analyzed for quantification. This carbon-dot-based assay allowed fluorescent sensing of target oligonucleotides with various sizes and visualization even with minimal amount of DNA (approximate to 100 pmol). Finally, the assay can be applied as a nanosensor platform for detecting bacterial DNA for the antibiotic-resistance gene KPC-2 from Klebsiella pneumoniae. This method provides a simple technique for detecting molecular targets, showing wide applicability for diagnostics on the bedside or point-of-care testing.