Doping to induce suitable impurity levels is an effective strategy to achieve highly efficient photocatalytic overall water splitting (POWS). However, to predict the position of impurity levels, it is not enough to only depend on the projected density of states of the substituted atom in the traditional method. Herein, taking in phosphorus-doped g-C3N5 as a sample, we find that the impurity atom can change electrostatic potential gradient and polarity and then significantly affect the spatial electron density around the substituted atom, which further adjusts the impurity level position. Based on the redox potential requirement of POWS, we not only obtain suitable impurity levels but also expand the visible light absorption range. Simultaneously, the strengthened polarity induced by doping further improves the redox ability of photogenerated carriers. Moreover, the enhanced surface dipoles obviously promote the adsorption and subsequent splitting of water molecules. Our study provides a more comprehensive view to realize accurate regulation of impurity levels in doping engineering and gives reasonable strategies for designing an excellent catalyst of POWS.