The use of the piezoelectric effect for regulating theseparationand transportation of charge carriers in the artificial photosynthesisof H2O2 has been established as a promisingapproach. However, an in-depth and comprehensive understanding ofthe piezoelectric effect on photocatalysis is still far from satisfactory.Herein, we have accurately modulated the molecular structure of graphiticcarbon nitride (CN) to investigate the effect of piezoelectricityon photocatalytic H2O2 production over CN. Ourresults show that the role of the piezoelectric effect in photocatalyticH(2)O(2) production over CN strongly depends onthe molecular structure of CN. Specifically, for CN, CN modified byphosphorus (CN-P), oxygen-functionalized CN (CN-OF), and cyano-group-graftedCN (CN-CA), the photocatalytic activity of CN, CN-P, and CN-OF isenhanced by approximately 1.40, 1.46, and 1.51 times due to the piezoelectriceffect, respectively, while the photocatalytic activity of CN-CA isdecreased by 6.0 times. To clarify and understand the key factorsaffecting piezo-photocatalysis activity, we employed density functionaltheory, photo-electrochemical measurements, and piezoresponse forcemicroscopy measurements to explore active sites, piezoelectric polarization,and charge separation over molecular-functionalized CN. Our resultsreveal that the impact of the piezoelectric effect on photocatalyticH(2)O(2) production over CN results from the comprehensiveinfluence of multiple factors. This work not only demonstrates thatthe molecular structure of CN determines whether the piezoelectriceffect improves photocatalytic H2O2 productionover CN but also unveils the mechanism of the piezoelectric effecton photocatalytic H2O2 production over CN.