Magmatic oxygen fugacity (fO2) is a fundamental property to understanding the long-term evolution of the Earth’s atmosphere and the formation of magmatic-hydrothermal mineral deposits. Classically, the magmatic fO2 is estimated using mineral chemistry, such as Fe-Ti oxides, zircon, and hornblende. These methods, however, are only valid within certain limits and/or require a significant amount of a priori knowledge. In this contribution, a new oxybarometer, constructed by data-driven machine learning algorithms using trace elements in zircon and their corresponding independent fO2 constraints, is provided. Seven different algorithms are initially trained and then validated on a data set that was never utilized in the training processes. Results suggest that the oxybarometer constructed by the extremely randomized trees model has the best performance, with the largest R2 value (0.91 ± 0.01), smallest RMSE (0.45 ± 0.03), and low propagated analytical error (~0.10 log units). Feature importance analysis demonstrates that U, Ti, Th, Ce, and Eu in zircon are the key trace elements that preserve fO2 information. This newly developed oxybarometer has been applied in diverse systems, including arc magmas and mid-ocean ridge basalts, fertile and barren porphyry systems, and global S-type detrital zircon, which provide fO2 constraints that are consistent with other independent methods, suggesting that it has wide applicability. To improve accessibility, the oxybarometer was developed into a software application aimed at enabling more consistent and reliable fO2 determinations in magmatic systems, promoting further research.