For the past few years, air quality has surged to worldwide attention. For NO x purification, semiconductor photocatlysis as a green technology that could use sunlight to purify air pollutants, provides an attractive alternative to decrease pollution. Recently, polymeric graphitic carbon nitride (g-C 3 N 4 ) materials have drawn intensive attention because of its metal-free and high-hardness features, reliable chemical inertness, thermal stability, as well as its versatile optical, electrochemical, and efficient photocatalytic properties. But pure g-C 3 N 4 suffers from rapid recombination of photo- generated electron-hole pairs resulting in low photocatalytic activity. Thus, several coping modifying methods were employed to improve the photocatalytic performance of g-C 3 N 4 . The present work developed a facile in situ method to construct novel k-doped g-C 3 N 4 (CN-K) structure with molecular composite precursors. In this work, the samples were prepared via pyrolysis of thiourea and a certain amount of KI as the potassium source in a muffle furnace. Different mass ratio (1%, 3%, 5%, 10%) of K-doping g-C 3 N 4 samples were prepared by changing the amount of KI. The as-prepared samples were systematically characterized by XRD, SEM, TEM, XPS, BET, UV-vis DRS and PL. Material studio was used to simulated the crystalline structure of potassium doped g-C 3 N 4 . The bond structure of as-prepared samples can be theoretical calculation by DFT theoretical calculation. Both the experimental and theoretical calculation results indicated that potassium ion which were formed chemical bond with nitrogen existed in the interlayer of g-C 3 N 4 . The modified catalyst exhibited outstanding photocatalytic activity and photochemical stability towards degradation of NO at ppb-level under visible light irradiation. The superior activity can be ascribed to the significant function of potassium ion worked on morphological structure, band gap and electronic-hole recombination of as prepared samples. Firstly, evidenced by valence band XPS and DFT theoretical calculation, potassium doping has the function of modifying band-gap, making for down-shift both conduction band and valence band, however, The extent of the conduction band down shifting more than the valence band, shortening down the optical band gap more while making a significant enhancement of the solar light response range, thus the absorption capacity of as prepared samples strengthen significantly. Secondly, the separation efficiency of photon-generated carriers increased with potassium doped in the interlayer of g-C 3 N 4 verified by room temperature PL spectra. Thirdly, the in situ K-doped g-C 3 N 4 showed higher oxidation capacity of photo-induced holes for degradating NO, ascribed to a more positive valence band. Integrated three factors, purification efficiency of NO has been significantly improved. This work could provide a new perspective for modification of photocatalyst with alkali metals and mechanism understanding of NO degradation.