It is notably challenging to fabricate heavily heteroatom-doped porous carbonaceous materials with narrow ultramicropore size distributions for highly effective mixed-gas separation. In this study, new carbon-based materials with narrow ultramicropore size (95%) and high N doping contents (>10 at%) are fabricated through the pyrolysis of a perchloro-substituted porous covalent triazine-based framework (ClCTF). In particular, the sample prepared at 650 °C (ClCTF-1-650) possesses the highest ultramicropores content (98%) and large N content (12 at%) and demonstrates a very high CH and CO capacity, as well as a low N uptake under ambient conditions. The extraordinarily high CH/N and CO/N selectivities correlate with both the ideal adsorption solution theory (IAST) method and performed dynamic separation experiments (breakthrough experiments). The results reported in this study far exceed the CH/N and CO/N selectivities of previously reported carbon-based adsorbents including various nitrogen-doped ones. These results are believed to be associated with the unusually high N content, as well as the suitably narrow ultramicropore size distribution. This report introduces a new pathway to design porous absorbents with precisely controlled ultramicropores for gas separation.