The inferior cycling stability critically impedes the development of potassium-ion batteries (KIBs). The solid electrolyte interface (SEI) for nitrogen doped graphite foam (NGF) was studied in both KPF6 and KN(SO2F)2 (KFSI)-based organic electrolytes, aiming to unravel the SEI effect on K+ ion storage mechanism. Electrochemical characterizations disclose that the KN(SO2F)2-based cells deliver improved electrochemical performance in terms of reversibility and cycling stability, compared to KPF6 based cells. Experimental results including depth-profiling XPS and FTIR spectra, together with the theoretical calculations, reveal that (CH2OCO2K)2, C2H5OCO2K, KF and K2CO3 are the dominant components of SEI layers in both electrolytes. Particularly, the amount of K2CO3 in KPF6-based electrolyte is much more than that in KFSI-based electrolyte, resulting in inferior stability. Moreover, the depth-profile XPS results indicate that the SEI formed in KFSI based electrolyte is much more stable, compact and thinner than that in KPF6 based electrolyte. All these features, together, ensure good stability and high reversibility in KFSI-based electrolyte. The nitrogen doping effect on K+ ion storage was also explored. Enhanced electrochemical performance was identified upon increasing the nitrogen content, due to i) the enrichment of active sites for K+ ion storage and ii) the improved electronic conductivity. Moreover, the electrochemical performance is strongly dependent on N-doping types. Specifically, the pyridinic nitrogen dominates the reversible capacity, as identified by the presence of critical point at 4.29 at. %. In which, the atomic ratio of pyridinic N in NGF is 2.53 at. %, which is higher than that of 7.03 at. %, with only 2.16 at. % pyridinic N. The result is consistent with the theoretical study, which verifies that the charge transferred from K ions to NGF increases with the pyridinic nitrogen doping. Our results promote better understanding of K+ ion storage mechanism in graphite and provide invaluable guidance for optimized carbon-based electrode design for high-performance KIBs.