Poly(ionic liquid) has recently served as an important precursor for nitrogen-doped functional porous carbons. It was applied here in a facile one-pot approach to synthesize nitrogen-doped porous carbon nanosheets (NPCNSs) using C3N4 nanosheets as sacrificial templates. C3N4 nanosheets are found to improve the carbonization yield and nitrogen content of NPCNSs and additionally facilitate the formation of a unique pore structure. Without post-treatments or activation steps, the as-synthesized NPCNS readily reaches a specific surface area above 1100 m2 g?1 with hierarchical micro-/meso-/macropore structures while keeping a high nitrogen content (17.4 wt%). More significantly, the NPCNS is able to deliver not only a high CO2 adsorption capacity with outstanding reversibility, but also an unprecedented capacity in methylene blue uptake by 962.1 mg g?1, which is among the few highest ever reported for wastewater, with excellent reusability.