Efficient absorption of light in visible range and enhance separation of photoexcited electron-hole pairs (EHPs) are crucial for improving the photoactivity of metal nonmetal codoped TiO 2. By using density functional theory (DFT) calculations, an effective metal ( Ag ) and nonmetal ( N ) codoping approach is described to modify the photoelectrochemical properties of titanium dioxide ( TiO 2). Nitrogen (N) doping introduces isolated N -2p states above the valence band maximum (VBM) which acts as an electron trap to promote EHP recombination. For Ag -doped TiO 2, Ag -4d states are introduced above the VBM which leads to the band gap narrowing. Silver (Ag) and nitrogen codoped TiO 2 possess stable configuration, narrowed band gap and best visible light absorption. Defect pair binding energy calculation shows that individual dopants, located at a distance of 8.951 Å bind each other, which indicates that the defect pair is stable compared to the isolated impurities in the host lattice. Ag and N codoped TiO 2 shows better visible light absorption as compared to other doped models due to the reduced band gap. N doping reduces the band gap of TiO 2 while Ag doping enhances the EHPs separation, so their combined presence in a sample would improve the photocatalytic activity due to their synergistic codoping effect. Our calculations provide reasonable explanation for the experimental findings.