Controlling the structure of semiconductors to tailor are physicochemical and photoelectronic structure features. Graphitic carbon nitride has triggered a new impetus in the field of photocatalysis. However, the rapid recombination of charge carriers limited its photocatalytic activity. Herein, we demonstrate that potassium doped and nitrogen defects into graphitic carbon nitride (KCNx) framework are favorable for visible light harvesting, charge separation and have highly efficient photocatalytic behavior for water splitting. It exhibits a high hydrogen evolution activity of 59.9 mmol·g−1·h−1 (66.6 times much higher than that of pristine g-C3N4), and remarkable apparent quantum efficiency of 57.17% at 420 nm. The superior photocatalytic performance of the KCNx sample was attributed to the less recombination rate of photogenerated electron and hole, and enhanced conductivity, which was proven by photoelectrochemical and PL. This work reveals the synergistic mechanism of introducing foreign elements and defects into the framework of graphitic carbon nitride to improve its photocatalytic activity.