Herbivory has evolved multiple times during mammalian diversification, playing a key role in the success of this globally distributed clade. A central metabolic challenge for herbivores is the detoxification of glyoxylate. The enzyme alanine:glyoxylate aminotransferase (AGT) converts glyoxylate to glycine, preventing the formation of harmful calcium oxalate crystals. AGT localizes to mitochondria and peroxisomes based on the mitochondrial targeting sequence (MTS) and the peroxisomal targeting signal (PTS1), respectively. While most studies focused on MTS, MTS variation alone does not fully explain AGT localization patterns. To assess the relative importance of the PTS1 motif, we combined comparative sequence analyses with functional assays. We find that multiple herbivorous lineages underwent independent mutations resulting in disrupted or truncated MTS regions, whereas the PTS1 motif remains functional. Immunofluorescence assays revealed more efficient peroxisomal localization of AGT in herbivores, with PTS1 often overriding mitochondrial signals even when the MTS is intact. Additionally, transcriptomic analyses show that several herbivorous lineages preferentially use downstream transcriptional start sites, producing AGT isoforms lacking the MTS. Together, our findings reveal a central role of AGT peroxisomal targeting in evolution of plant-based diets, and demonstrate how increased targeting efficiency has evolved convergently via the interplay of transcriptional regulation and targeting signals. Herbivory has evolved multiple times across mammals. This study investigates the evolutionary adaptation of the enzyme alanine:glyoxylate aminotransferase (AGT) in mammals and finds AGT’s peroxisomal targeting efficiency, driven by the PTS1 motif, plays a crucial role in adapting to plant-based diets. The independent evolution of plant-based diets has occurred multiple times throughout the diversification of mammals, and is a key factor contributing to the evolutionary and ecological success of this group1. Fossil evidence indicates that early mam... [56261 chars]