In the present study, carbon dots (C-dots) were synthesized using a simple and uncomplicated pyrolysis method at 250 °C with varying duration of 1 h, 2 h, and 3 h, utilizing Pennisetum glaucum as the biomass precursor to break down methylene blue (MB) and Rose Bengal (RB) dyes under UV light exposure. Various analytical techniques, including X-ray diffraction (XRD), UV–visible spectroscopy, high-resolution transmission electron microscopy (HR-TEM), Fourier-transform infrared spectroscopy (FT-IR), and vibrating-sample magnetometer (VSM), were utilized to investigate the chemical, optical, electronic, surface morphological, and magnetic characteristics of the C-dots produced. These C-dots are crystalline, nearly spherical, and have particle sizes ranging from 4.73 nm to 12.44 nm. FTIR analysis identified the functional groups present on the surface of the C-dots. Additionally, the band gap energy of the C-dots reduced from 2.82 eV to 2.40 eV with an increase in pyrolysis time. They are effective for cleaning dye-polluted wastewater and demonstrate high photocatalytic performance. When exposed to UV light, the synthesized particles achieved impressive photocatalytic degradation of 94.80 % for MB and 91.80 % for RB dyes.