Microporous activated carbon originating from coconut shell, as received or oxidized with nitric acid, is treated with melamine and urea and heated to 950 °C in an inert atmosphere to modify the carbon surface with nitrogen- and oxygen-containing groups for a systematic investigation of their combined effect on electrochemical performance in 1 M H2SO4 supercapacitors. The chemistry of the samples is characterized using elemental analysis, Boehm titration, potentiometric titration, and X-ray photoelectron spectroscopy. Sorption of nitrogen and carbon dioxide is used to determine the textural properties. The results show that the surface chemistry is affected by the type of nitrogen precursor and the specific groups present on the surface before the treatment leading to the incorporation of nitrogen. Analysis of the electrochemical behavior of urea- and melamine-treated samples reveal pseudocapacitance from both the oxygen and the nitrogen containing functional groups located in the pores larger than 10 Å. On the other hand, pores between 5 Å and 6 Å are most effective in a double-layer formation, which correlates well with the size of hydrated ions. Although the quaternary and pyridinic-N-oxides nitrogen groups have enhancing effects on capacitance due to the positive charge, and thus an improved electron transfer at high current loads, the most important functional groups affecting energy storage performance are pyrrolic and pyridinic nitrogen along with quinone oxygen.