Carbon aerogel is a porous carbon material possessing high porosity and high specific surface area. Nitrogen doping reduced the specific surface area and micropores, but it furnished basic sites to improve the CO2 selectivity. In this work, N-doped carbon aerogels were prepared with different ratios of resorcinol/melamine by using the sol-gel method. The morphological properties were characterized by scanning electron microscopy (SEM). Nitrogen content was studied by X-ray photoelectron spectroscopy (XPS) and the specific surface area and micropore volume were analyzed by N2 adsorption-desorption isotherms at 77 K. The CO2 adsorption capacity was investigated by CO2 adsorption-desorption isotherms at 298 K and 1 bar. Melamine containing N-doped CAs showed a high nitrogen content (5.54 wt.%). The prepared N-doped CAs exhibited a high CO2 capture capacity of 118.77 mg/g (at resorcinol/melamine = 1:0.3). Therefore, we confirmed that the CO2 adsorption capacity was strongly affected by the nitrogen moieties.