Organic-inorganic halide perovskites <i>ABX</i><sub>3</sub> (<i>A</i> = CH<sub>3</sub>NH<sub>3</sub>, HC(NH<sub>2</sub>)<sub>2</sub>; <i>B</i> = Pb; <i>X</i> = Cl, Br, I) have recently attracted increasing attention due to their advanced optoelectronic properties. However, the poor stability and toxicity of organic lead halogen perovskites are still a major challenge for deploying the outdoor solar cells. Element substitution is a simple and effective strategy to solve these problems. For example, the substitution of the I ions with Cl and Br has been regarded as a reliable method to improve the device stability. <i>A</i>-site engineering, i.e., replacing organic ions with inorganic cations (such as Cs<sup>+</sup>, Rb<sup>+</sup>), has also been reported. The <i>B</i>-site alloying approach has been demonstrated with Zn, Sr, Sn, etc. Inorganic halide perovskites can be synthesized by the low-cost solution spin-coating method and have similar optoelectronic properties and improved stability to their organic counterparts. Here in this paper, we report a comprehensive study of the alloyed perovskite CsPb<sub>1–<i>x</i></sub>Ba<sub><i>x</i></sub><i>X</i><sub>3</sub> (<i>X</i> = Cl, Br, I) by combining the disorder alloy structure search method with first-principles energy calculations. We find that it is not easy to dope barium into the perovskite lattice when Ba concentration is low and the stable disordered solid solution can exist in the high Ba concentration case. Carrier effective mass and bandgap increase with the increase of Ba concentration and the bandgap change range is wide, owing to the difference in both electronegativity and ionic radius between Pb and Ba. After inducing Ba into CsPb<sub>1–<i>x</i></sub>Ba<sub><i>x</i></sub><i>X</i><sub>3</sub> (<i>X</i> = Cl, Br, I), the higher electron concentration on the I sites also enhances the Coulomb interaction of the Pb—I bonds. Moreover, the electrons and holes tend to be located on Pb sites, and this may give rise to the formation of local potential wells, which would further induce the large lattice deformation to accommodate the self-trapped excitons. Especially, CsPbI<sub>3</sub>-<i>Pnma</i> perovskite is metastable in the ambient environment with a suitable photon absorption threshold. The CsPb<sub>1–<i>x</i></sub>Ba<sub><i>x</i></sub>I<sub>3</sub> can be used as a capping layer on CsPbI<sub>3</sub> in solar cells, thereby significantly improving the power conversion efficiency and long-term stability. Overall, the alloyed perovskite CsPb<sub>1–<i>x</i></sub>Ba<sub><i>x</i></sub><i>X</i><sub>3</sub> (<i>X</i> = Cl, Br, I) with high Ba concentration can be stable and less-toxic, and they can be used in short wave light-emitting diodes, radiation detectors or other fields because of their large bandgaps (> 2.8 eV).