Pollution from water-soluble dyes is a common issue due to high toxicity and diffiulty in degradation, and its effectively removal is critical for human health and sustainability. In this work, N-doped hierarchical carbons were derived by facile pyrolysis of Co-including hexamine-based complex using glucose as a cross-linker, showing high removal ability using Rhodamine B (RhB) as a model dye. Porous architecture and N-coordination can be easily altered by pyrolysis temperature, where the GNC-900 sample obtained at 900 °C exhibits the best removal ability even outperforming several classical carbons under equal conditions, owing to synergistic effects from large surface areas, high ratio of pyrrolic-N, enhanced interaction between RhB molecules and pore walls, and possible Co-Nx active sites. Adsorptive behaviour is better fitted by pseudo-second-order kinetic model, and the maximum RhB capacity over GNC-900 determined by Langmuir model is highly up to 400.1 mg/g, following mechanisms of pore filling, π-π conjugation, electrostatic, surface complexation and H-bonding. Thermodynamics indicate that RhB removal is exothermic and spontaneous process. Moreover, GNC-900 can be readily regenerated using ethanol and reused at least six times without notable loss in capacity. This novel method facilitates synthesis of N-doped carbons from metal-based complexes, exhibiting high efficiency as adsorbents for water remediation.