The aim of this study was to investigate the photolysis mechanism of ketoprofen (KET) under simulated sunlight. The results demonstrated that the photolysis of KET aligned well with pseudo first-order kinetics. Radical scavenging experiments and dissolved oxygen experiments revealed that the superoxide anion radical (O2˙-) played a primary role in the photolytic process in pure water. Bicarbonate slightly increased the photodegradation of KET through generating carbonate radicals, while DOM inhibited the photolysis via both attenuating light and competing radicals. Moreover, Zhujiang river water inhibited KET phototransformation. Potential KET degradation pathways were proposed based on the identification of products using LC/MS/MS and GC/MS techniques. The theoretical prediction of reaction sites was derived from Frontier Electron Densities (FEDs), which primarily involved the KET decarboxylation reaction. The ecotoxicity of the treated solutions was evaluated by employing Daphnia magna and V. fischeri as biological indicators. Ecotoxicity was also hypothetically predicted through the "ecological structure-activity relationship" (ECOSAR) program, which revealed that toxic products might be generated during the photolysis process.