A hybrid Na, B, and O codoped g-C 3 N 4 /polypyrrole carbon black (CCNP) hydrogel is prepared via an in situ cross-linking method for percarbonate activation under visible light irradiation. The structural, morphological, and optical characterizations proved the tuned bandgap, enriched utilization of visible light, minimum recombination ratio, and higher separation efficiency. The CCNP hydrogels could easily activate the percarbonate under visible light, leading to abundant production of reactive radicals, which aids in the degradation of tetracycline in wastewater. About 96% of tetracycline was degraded in 15 min at its natural pH. The superoxide, carbonate, and hydroxyl radicals were the important radical species in tetracycline degradation. The CCNP hydrogels also exhibited high photostability and reusability up to six cycles. The tetracycline degradation pathway is given a special focus, and the percarbonate activation mechanism is highlighted. This study provides a new strategy for boosting the performance of g-C 3 N 4 -based catalysts for percarbonate activation and wastewater remediation.