The basal dislocations play a key role in the deformation of hexagonal Mg alloys. However, its core structure and mechanical behavior have thus far not yet been understood adequately, largely owing to the fact that the basal dislocation, often decorated with segregated solute atmosphere and dissociated into two partials, cannot be modeled accurately. Significant discrepancies exist between theoretically calculated and experimentally observed structures for these dissociated dislocations. Here we present a comprehensive theoretical scheme to model them in the Mg alloys with alloying elements of Y, Zn, Al and Li, respectively. Firstly, solute–dislocation interactions were computed by appropriate first-principles calculations. Secondly, the statistic solute concentration at a dislocation is estimated by a Fermi–Dirac distribution. Finally, all these effects on dislocations are integrated into an improved two-dimensional Peierls–Nabarro model to predict their core structures and mechanical behaviors in Mg alloys. It is shown that although Zn, Al and Li atoms have little effect on basal dislocations, Y atoms can largely increase their dissociated width. Furthermore, when it moves from its ground state configuration, the dissociated dislocation can further be widened, such that its dissociated widths in a Mg–0.8Y (at%) alloy at 300 K can reach 12–36 nm, in rather good agreement with the experimentally observed values of 20–30 nm. Besides, the Peierls and yield stresses of Mg alloys shall increase with increasing added solute concentration, while they are decreased drastically with increasing the temperature from 300 to 800 K, but with the Mg-Y alloy as somewhat exception, which is again consistent with experimental observations.