Abstract This study optimizes the optoelectronic properties of β-Ga₂O₃ through Mg-Al co-doping, enhancing its potential for broadband optoelectronic applications. The modifications behind Mg-Al co-doping were revealed through calculations of the band structure, density of states, and optical properties. The results indicate that Mg-Al co-doping effectively modulates the bandgap (1.86-5.08 eV) by introducing an optimal amount of impurity energy levels, with the bandgap increasing as the concentration rises. Compared to single doping, the co-doped system reduces the likelihood of electron complexation and improves carrier separation efficiency. Optical property analysis reveals that low-concentration Mg-Al co-doping improves the static dielectric constant and exhibits strong absorption in both the UV and visible regions, particularly in the 1.25 at% co-doped system. In contrast, high-concentration co-doping demonstrates notable advantages in UV absorption and reflection properties. Furthermore, the Mg(2)-Al(1) system slightly outperforms the Mg(1)-Al(2) system at the same doping concentration. These findings provide valuable insights into the application of β-Ga₂O₃ in UV-visible photodetectors, transparent conductive films, and related fields.