In the present paper, the lattice structure, band structure and density of state of LaAlO3 and LaAlO3:Mg are calculated by first-principle method based on density functional theory. Firstly, we select the different cutoff energy and k-point grid in the calculations, and obtain the most stable geometry structure of single crystal LaAlO3. The calculated lattice parameters are a=b=5.441 Å, c=13.266 Å, which matches with experimental values. To deeply understand the electronic structure of LaAlO3, a 2×1×1 super-cell structure is established and the doping concentration of Mg at Al sites is 25%. From the band structure and density of states, it can be seen that LaAlO3 has a direct band gap Eg=3.6 eV. However, LaAlO3:Mg has a larger band gap Eg=3.89 eV and the Fermi level enters into the valence band, which indicates the holes are introduced. The calculated results show that the conductivity of LaAlO3:Mg is better than pure LaAlO3, which is in good agreement with experimental results.