p-Type conductivity and optical properties of beta-Ga2O3 with Mg and P single- and co-doping were studied using density functional theory (DFT). Four Mg and P single-doped models with different doping sites (Mg1, Mg2, P1 and P2) and four Mg-P co-doped models (Mg1P1, Mg1P2, Mg2P1 and Mg2P2) were built. DFT calculation results showed that the Mg or P single doping introduced deeper acceptor levels, making it difficult to achieve effective p-type conductivity. Alternatively, the Mg-P co-doping improved the p-type conductivity of beta-Ga2O3 to a certain extent. Among the four co-doped models, the Mg1P1 and Mg2P2 models introduced relatively shallow acceptor levels of 0.14 and 0.15 eV, respectively, which improved the migration ability of electrons and holes compared to deeper levels. However, the intrinsic carrier mobilities in beta-Ga2O3 remained low, and doping primarily affected the carrier populations rather than intrinsic conductivity. The Mg1P2 and Mg2P1 models showed poor conductivity owing to the deep acceptor levels. For all Mg-P co-doped systems, doped Mg atoms lost more electrons than the corresponding gallium atoms before doping, while neighboring oxygen atoms obtained more electrons than the corresponding oxygen atoms before doping. P atoms gained fewer electrons than the corresponding oxygen atoms before doping, while neighboring gallium atoms lost fewer electrons than the corresponding gallium atoms before doping. The optical absorption of the P and Mg single- and co-doped systems extended to the visible light region, and their absorption intensities increased compared with pure beta-Ga2O3. However, the degree of variation in optical absorption intensity changed across different wavelength ranges for different doping models, which can be applied in different fields.