As a kind of typical lean meat essences and veterinary drugs, ractopamine (RAC) has been frequently detected in agricultural sewage and livestock, posing potential risk to both aquatic ecosystems and human health. Despite its widespread occurrence, the environmental fate of RAC remains unclear. Here, the mechanisms underlying the direct and indirect photodegradation of RAC was investigated under UV light irradiation at wavelengths of 275 and 365 nm, respectively. The effect of pH, initial concentration, and co-existing ions were examined. For direct photodegradation, the quantum yield of RAC increased with increasing pH values. In solutions containing dissolved organic matter (DOM), indirect photodegradation of RAC intensified with increasing pH values, and the initial concentration of DOM accelerated the process. The presence of Cu2+ was found to inhibit both direct and indirect photodegradation of RAC. Electron spin resonance (ESR) spectrometry and quenching experiments revealed that direct photodegradation was primarily attributed to the decomposition of the triplet state of RAC. Both the triplet state of DOM (3DOM*) and singlet oxygen contributed to the indirect photodegradation of RAC. LC-MS/MS analysis indicated that oxidation of the phenol group and subsequent decarboxylation were the principal photodegradation processes. The energies of each state of RAC and the active sites of RAC molecules were computed using frontier molecular orbitals and Fukui indices based on density functional theory. Combining the analysis of photoproducts with energy calculation, pathways of the direct and indirect photodegradation of RAC were proposed. These findings unveiled the photochemical behaviors of RAC concerning the removal and attenuation in aquatic environment.