In this study, nitrogen defect (cyano-group and N vacancy)-modified mesoporous g-C3N4(CNMCN) was synthesizedviaa newin situsilica gel strategy. Resultant CNMCN was analyzedvianumerous techniques such as TEM, BET, XRD, FTIR, XPS, PL and DRS. The results revealed that the introduced mesoporous structure, cyano-group and N vacancy, could increase surface area, improve the separation of photoinduced charge and heighten light response capacity. These positive factors promoted CNMCN exhibiting better photocatalytic ability for splitting water, its H(2)evolution rate was around 14.7-fold more than that of bulk g-C3N4, and excellent continuous service capacity was also showed. Moreover, CNMCN had better performance than mesoporous g-C3N4, cyano-group modified g-C(3)N(4)and N vacancy modified g-C3N4. Apparently, this present study provides a new thought for preparing mesoporous structure N defect-modified g-C3N4, which might be applied in clean energy production and environmental restoration.