The electronic structures and optical properties of N-doped, S-doped and N/S co-doped SrTiO3 have been investigated on the basis of density functional theory (DFT) calculations. Through band structure calculation, the top of the valence band is made up of the O 2p states for the pure SrTiO3. When N and S atoms were introduced into SrTiO3 lattice at O site, the electronic structure analysis shows that the doping of N and S atoms could substantially lower the band gap of SrTiO3 by the presence of an impurity state of N 2p on the upper edge of the valence band and S 2p states hybrid with O 2p states, respectively. When the N/S co-doped, the energy gap has further narrowing compared with only N or S doped SrTiO3. The calculations of optical properties also indicate a high photo response for visible light for N/S co-doped SrTiO3. Besides, we find a new impurity state which separates from the O 2p states could improve the photocatalytic efficiency and we also propose a model for light electron-hole transportation which can explain the experiment results well. All these conclusions are in agreement with the recent experimental results.