The effects of C cation and S cation doping on the electronic structures and optical properties of SrTiO3 are investigated by density function theory (DFT) calculations. The calculated results reveal that the top of the valence band is predominately made up of the O 2p states for the pure SrTiO3. When SrTiO3 was doped with C cation and S cation, the top of the valence bands consists mainly of O 2p+C 2s hybrid orbitals and O 2p+S 3s hybrid orbitals, respectively. The band gap of SrTiO3 is narrowed by the doping with C cation and S cation, especially for the C and S-codoped SrTiO3. Moreover, the red shifts of the absorption edge are found by the calculated optical properties, which is consistent with reported experiment results. It is the explanation for their visible light respondency by the presence of C 2s and S 3s states on the upper edge of the valence band. All of these results can explain the good photocatalytic properties of C, S cation-codoped SrTiO3 under visible light irradiation.