First-principles calculations with DFT+U method were conducted on the local structures and the in-gap electronic states of n-type SrTiO3, whose electron doping was realized by substitution of Sr by La or Ti by Nb. For both La-doped and Nb-doped SrTiO3, cubic structures were proved to be stable e3ven when tetragonal structures were assumed, as suggested also in a reported experimental study. In La-doped SrTiO3, O atoms neighboring the substitutional La were symmetrically attracted toward the dopants. Sharp electron band observed at the top of the bandgap, which gave n-type conductivity and resulted from the intersection of Fermi energy level at the conduction band bottom with La-doping, was composed of 3d orbitals in Ti. The La-doping transformed some of the p electrons in O into the d electrons in Ti in the sharp band, and these electrons at Fermi level were expected to act as n-type carriers. In Nb-doped SrTiO3, on the other hand, Ti atoms at the first, second and third nearest neighbors of the Nb, which were in the same Ti-O plane surrounding the dopants, were repelled away from the Nb dopants to be isotropic local expansion, while O atoms neighboring Nb were attracted toward the dopants in the expanded local structure. Sharp band of the in-gap states just below the Fermi energy of the Nb-doped SrTiO3 was not only of the 3d orbitals in the first nearest-neighbor Ti atoms, but also of those in the second and third nearest-neighbor Ti atoms of the dopants. The degree of Fermi level intrusion into conduction band and atomic rearrangements near Nb substitutions were milder than those of La substitutions. As replacement of Sr atoms by La not contained in Ti-O network does not disturb the electron transport within Ti-O conduction planes, Nb-doping in Ti site does not interrupt the n-type carrier transportation even though Nb atoms are in Ti-O network, because of the formation of conduction path which bypasses the unit cell containing the dopants.