For titanium dioxide with anatase structure doped with carbon or nitrogen, the first-principle method of projector augmented waves (PAW) is used to calculate electronic band structure, to evaluate vacancy formation energy for the oxygen sublattice, and to analyze optical absorption. It is demonstrated that the presence of carbon dopants results in the stabilization of oxygen vacancies and leads to increased absorption in the visible spectrum, which can facilitate the photocatalytic activity. The presence of nitrogen dopant also facilitates vacancy stabilization but no increase in the interband absorption is expected in the visible spectrum, i.e., the presence of nitrogen dopant cannot be considered as a factor contributing to increased photocatalytic activity. It follows from the calculated data that the maximum photocatalytic activity should be expected for the partiallyreduced anatase doped with carbon because of the absorption in the visible spectrum that combines with long time of electron-hole recombination.