The electronic structures and the densities of states of Mg 8 Si 4 X 1 were calculated by using density functional theory, where semiconducting Mg 2 Si and a nonmetallic element, X, form interstitial alloys. When X is an inert gas element, the electronic structure is basically the same as that of Mg 8 Si 4 , but the bandgap increases (X = He or Ne) or decreases (X = Ar) depending on the degree of volume expansion caused by the interstitial alloying. In the case of X = electronegative element (O, F, or Cl), X works as an electron acceptor, which causes the transition of Mg 2 Si from an intrinsic semiconductor to a p-type semiconductor. This is also the case for X = H. When the electronegativity of X is intermediate (X = C, Si, N, P, or S), the bandgap at the R point of the reciprocal lattice of Mg 8 Si 4 becomes negligible. When X = B, a transition to an n-type semiconductor is predicted as in the case of doping with electropositive metal elements such as Li and Al, but the bandgap at the R point of the reciprocal lattice of Mg 8 Si 4 becomes negligible, as in the case of elements with intermediate electronegativities. © 2020 The Japan Society of Applied Physics 2.2. Calculation method Electronic structure calculations were done for geometrically optimized structures obtained by a full relaxation of each