Ultrafine metal nanoparticles (NPs) hold promise for applications in many fields, including catalysis. However, ultrasmall NPs are typically prone to aggregation, which often leads to performance losses, such as severe deactivation in catalysis. Conventional stabilization strategies (e.g., immobilization, embedding, or surface modification by capping agents) are typically only partly effective and often lead to loss of catalytic activity. Herein, a novel type of stabilizers based on water-soluble ionic (K+ and Na+ containing) polymeric carbon nitride (i.e., K,Na-poly(heptazine imide) = K,Na-PHI) is reported that enables effective stabilization of highly catalytically active ultrafine (size of ∼2-3 nm) gold NPs. Experimental and theoretical comparative studies using different structural units of K,Na-PHI (i.e., cyanurate, melonate, cyamelurate) indicate that the presence of functionalized heptazine moieties is crucial for the synthesis and stabilization of small Au NPs. The K,Na-PHI-stabilized Au NPs exhibit remarkable dispersibility and outstanding stability even in solutions of high ionic strength, which is ascribed to more effective charge delocalization in the large heptazine units, resulting in more effective electrostatic stabilization of Au NPs. The outstanding catalytic performance of Au NPs stabilized by K,Na-PHI is demonstrated using the selective reduction of 4-nitrophenol to 4-aminophenol by NaBH4 as a model reaction, in which they outperform even the benchmark "naked" Au NPs electrostatically stabilized by excess NaBH4. This work thus establishes ionic carbon nitrides (PHI) as alternative capping agents enabling effective stabilization without compromising surface catalysis, and opens up a route for further developments in utilizing PHI-based stabilizers for the synthesis of high-performance nanocatalysts.