The energetic and electronic properties of MgH2 co-doped with Ti and F are investigated using first-principles calculations based on density functional theory. The calculation results show that incorporation of Ti combined with F atoms into MgH2 lattice is energetically favorable relative to single incorporation of Ti atom. After dehydrogenation, the co-doped Ti and F in MgH2 preferably generate TiH2 and MgF2, respectively. Comparatively, the combined effect of Ti and F in improving the dehydrogenation properties of MgH2 is superior to that of pure Ti. These results provide a reasonable explan...