Doping with various impurities is an effective approach to improve the photoelectrochemical properties of TiO2. Here, we explore the effect of oxygen vacancy on geometric and elec- tronic properties of compensated (i.e. V-N and Cr-C) and non-compensated (i.e. V-C and Cr-N) codoped anatase TiO2 by performing extensive density functional theory calculations. Theoretical results show that oxygen vacancy prefers to the neighboring site of metal dopant (i.e. V or Cr atom). After introduction of oxygen vacancy, the unoccupied impurity bands located within band gap of these codoped TiO2 will be filled with electrons, and the posi- tion of conduction band offset does not change obviously, which result in the reduction of photoinduced carrier recombination and the good performance for hydrogen production via water splitting. Moreover, we find that oxygen vacancy is easily introduced in V-N codoped TiO2 under O-poor condition. These theoretical insights are helpful for designing codoped TiO2 with high photoelectrochemical performance.