Nitrogen-rich carbons synthesized from two melamine-based precursors - a melamine resin (MR) and a melamine network (MN) - were compared based on their pore structure, surface chemistry and electrochemical performance. The effect of carbonization temperatures on carbon pore structure and surface chemistry was investigated by N2 and CO2 sorption analyses, potentiometric titration, elemental analysis (CHN) and X-ray photoelectron spectroscopy (XPS). The carbons prepared from melamine resin had higher surface areas and pore volumes than the carbons produced from the melamine network, with carbonization of the MN at temperatures of 700 °C and higher leading to collapse of the MN pore structure. The electrochemical performances of the carbons were evaluated in 1 M H2SO4. The changes in carbon surface chemistry after charge-discharge cycles were studied for the two melamine-based carbons carbonized at 800 °C using Synchrotron XPS. This test demonstrated that in two-electrode 1 M H2SO4 the redox reactions involving surface nitrogen groups are reversible and redox reactions involving COOH take place. The results revealed the impact of the initial structure of the melamine precursors on the porosity along with the surface chemistry of the carbon matrix on the capacitive performance.