Previous studies have proved that the promoted interactions with bacteria was closely responsible for the improved inactivation efficiency of photocatalysts. Herein, for the first time, the cationic polymer polyethyleneimine (PEI) grafted O-doped g-C3N4 (denoted as PEI/OCN) was successfully fabricated by combination one-pot thermal-polymerization and subsequent covalent cross-linking reaction. Benefiting from the synergistic effect of O-doping and PEI-grafting, the obtained PEI/OCN possessed an extended and intensive visible light response, accelerated photogenerated charge transport, good hydrophilicity as well as enough electrostatic adhesion to bacteria. As a result, PEI/OCN exhibited a dramatically boosted reactive oxygen species (ROS) generation and outstanding rapid photocatalytic bactericidal capability, achieving 7.0 log CFU mL−1 inactivation efficiency of Escherichia coli (E. coli) within 30 min visible light exposure. Radical trapping and electron spin resonance (ESR) experiments revealed that superoxide radicals (•O2−) were crucially dominated the superior photocatalytic disinfection activity. Overall, the presented work provided a rationally designing of novel metal-free g-C3N4-based photocatalysts for efficient elimination of bacterial contaminations.