By means of first-principles calculations, we have investigated the effects of rare earth elements (REEs) on the structures and mechanical properties of magnesium. The lattice parameters, elastic constants, bulk moduli, shear moduli, Young's moduli and anisotropic parameter of these solid solutions have been calculated and analyzed. The nearest-neighbor distance between Mg and the REEs is also analyzed to explore the correlation with the bulk moduli. The results show that the 4f-electrons and atomic radii play an important role in the strengthening process. The anomalies of the lattice parameters and mechanical properties at Eu and Yb are due to the half-filled and full-filled 4f-electron orbital states. Finally, the increase of directional bonding character near the alloying elements may account for the anisotropy and brittleness of these magnesium alloys. There has been a rapid growth of interest in the development of magnesium alloy in the past decade since it is an important lightweight structural material as a replacement for aluminum and steels in automotive applications [1][2][3][4]. However, inherent limitations of strength and formability are obstacles to widespread application of magnesium in transportation industries. The strength of pure magnesium is lower than that of most aluminum alloys [5]. Hence, how to improve the strength of magnesium alloy is of great importance and interest. Solid solution strengthening is considered one of the most effective ways to improve the mechanical properties of the alloy and the mechanism contains elastic and electrical origin [1,6]. The elastic origin has been quantitatively established based on the impurity-dislocation interaction theory [7]. The atomic size factor makes great contribution in solid solution strengthening [8]. It is interesting that though the atomic size factor of Gd and Y is smaller than that of Al and Zn, they improve the mechanical properties more effectively than Al and Zn, according to Akhtar et al. [9] and Gao et al. [10]. Analogous phenomenon exists in Mg-Dy and Mg-Y alloys [11]. Gao et al. [10] give an explanation of the anomalous hardening of Mg-Y and Mg-Gd alloy from the view of the increase of chemical bonding strength. However, the systematic research of the Mg-Rare-Earth (Mg-RE) alloy has not been taken yet and the mechanism of the solid solution strengthening of Mg-RE alloy has not been elucidated. Therefore, it is necessary to systematically investigate the effect of the REEs on the structure and mechanical properties of magnesium. To shed light on the above problem, in this paper we have performed a systematic investigation of the lattice parameter, elastic constants and mechanical properties of the Mg-RE alloys by first principle calculations. Electron localization function (ELF) is also analyzed to give further interpretation of the mechanical properties from the electronic origin.