Carbon xerogels were prepared from a nitrogen-containing polymer precursor, using melamine and urea as nitrogen sources incorporated into the polymer matrix using the sol-gel process. To investigate the effects of nitrogen on the texture, morphology and surface chemistry, the carbon xerogels were characterized by nitrogen adsorption, scanning electron microscopy, X-ray photoelectron spectroscopy (XPS), and acid-base titrations. The results showed that nitrogen was incorporated onto the surface as pyridine, pyrrolic/pyridine, quaternary nitrogen, and pyridine-N-oxide. From the deconvolution of the XPS spectra, the pyrrolic/pyridine and quaternary nitrogen functionalities were found to dominate in the samples prepared from urea. All samples showed increased basicity after nitrogen incorporation. (C) 2009 Elsevier Ltd. All rights reserved.