Developing the cathode material with high voltage and high capacity is of critical importance in improving the energy density of the battery. Among various cathode materials, LiCoO
2, as the first commercialized cathode material for lithium-ion batteries, is still widely concerned by many researchers due to its high output voltage, high volumetric energy density, and excellent cycling performance. However, a series of issues, such as serious capacity fading and performance deterioration, can emerge as cut-off voltage is above 4.5 V. Many strategies have been proposed to stabilize the cycling performance of LiCoO
2at high voltages. Mg doping is considered to be an effective strategy to improve the high voltage cycling stability of LiCoO
2cathode material, but the specific doping form and mechanism of Mg doping still need to be further studied. In this paper, the values of formation energy and the electronic structures of various configurations for Mg doping on Co and Li sites in LiCoO
2are investigated by the first-principles method based on density-functional theory. The calculated results show that the values of formation energy for different doping configurations are different and the substitution of Mg in LiCoO
2is complicated. When the doping concentration is 3.7%, Mg prefers to substitute for the Co site; while the doping concentration increases to 7.4%, Mg can replace not only the Co or Li sites, but also the Co and Li sites simultaneously. Therefore, it should not be simply believed that Mg ion can replace only Co or Li site in LiCoO
2, depending on the specific doping situation actually. Furthermore, various doping configurations also exhibit different electronic states, including metallic state and semiconductor state, and what is more, electronic local states in many cases. Therefore, we believe that the Mg doping configuration in LiCoO
2is related closely to the doping amount, and the doping induced electronic structure also has a great difference.