Abstract Adsorption on porous solids is an emerging alternative for CO 2 capture that seeks to reduce the costs associated to the capture step. The enhancement of a specific adsorption capacity may be carried out by increasing the affinity of the adsorbent surface to CO 2. Nitrogen enrichment is reported to be effective in introducing basic functionalties that enhances the specific adsorbent–adsorbate interaction for CO 2. In this work a templating technique was used to produce highly porous nitrogen enriched carbons from melamine–formaldehyde resins. Nitrogen incorporated into the polymer matrix results in the greater stability of the adsorbents in terms of volatile and thermal loss of nitrogen. CO 2 capture performances were evaluated between 25 °C and 75 °C in a thermobalance. CO 2 adsorption capacities up to 2.25 mmol g −1 of CO 2 at 25 °C were achieved. Both texture and surface chemistry influence the CO 2 capture performance of the adsorbents. The carbonisation temperature used during the synthesis step controls the nitrogen functional groups present, as determined by XPS, with the loss of triazine nitrogen with increasing carbonisation temperature proposed to account for the decreased CO 2 affinity.