Global food production faces persistent threats from environmental challenges and pathogenic attacks, leading to significant yield losses. Conventional strategies to combat pathogens, such as fungicides and disease-resistant breeding, are limited by environmental contamination and emergence of pathogen resistance. Herein, we engineered sunlight-sensitive and biodegradable carbon dots (CDs) capable of generating reactive oxygen species (ROS), offering a novel and sustainable approach for plant protection. Our study demonstrates that CDs function as dual-purpose materials: priming plant immune responses and serving as broad-spectrum antifungal agents. Foliar application of CDs generated ROS under light, and the ROS could damage the plant cell wall and trigger cell wall-mediated immunity. Immune activation enhanced plant resistance against pathogens without compromising photosynthetic efficiency or yield. Specifically, spray treatment with CDs at 240 mg/L (2 mL per plant) reduced the incidence of grey mould in N. benthamiana and tomato leaves by 44% and 12%, respectively, and late blight in tomato leaves by 31%. Moreover, CDs (480 mg/L, 1 mL) combined with continuous sunlight irradiation (simulated by xenon lamp, 9.4 × 10