Supporting Information:

1. Electrochemical measurements employed in present work.

All electrochemical measurements employed in the present work were carried out on a CHI 660D electrochemical workstation (ChenHua Instruments Co. Ltd., Shanghai) at room temperature in a three-electrode cell using 6 mol L−1 KOH as electrolyte. Detailed electrochemical measurements are as follows:typically, 80 wt% of the carbon samplewas mixed with 15 wt% of acetylene black (>99.9%) in an agate mortar with a few drops of ethanol until a homogeneous solution was obtained. Subsequently,

5 wt % of polytetrafluoroethylene (PTFE) was added. After briefly allowing the solvent to evaporate, the resulting paste was pressed onto nickel foam under a pressure of

20 MPa with hydraulic press, serving as the current collector. The prepared electrode was placed in a vacuum drying oven at 120 ºC for 24 h.Each electrode contained about 4 mg of porous carbon material.In addition, Ni foam is selected as current collector for the sake of the convenience of comparability with major published data on nitrogen-containing carbon materials.Here, the prepared electrode, platinum foil and saturated calomel electrode (SCE) were used as the working, counter and reference electrodes, respectively.

Specific capacitances derived from galvanostatic tests can be calculated from the equation:

where C (F g−1) is the specific capacitance; I (A) is the discharge current; Δt (s) is the discharge time; ΔV (V) is the potential window; and m (g) is the mass of active materials loaded in working electrode.

Specific capacitances derived from cyclic voltammetry tests can be calculated from the equation:

where C (F g−1) is the specific capacitance; m (g) is the mass of active materials loaded in working electrode; v (V s−1) is the scan rate; I (A) is the discharge current; Vb and Va (V) are high and low potential limit of the CV tests.

Fig. S1. SEM images of the C-T-1:1sample (a) andtheC-D-1:1sample (b).

Fig. S2. Cyclic voltammograms at a scan rate of 20 mV s−1ofthe carbon samples obtained from solution-phase method (a) and solid-phase method (b).

Fig. S3. Galvanostatic charge-discharge curves measured at the current density of 10 A g−1 of the carbon samples obtained from solution-phase method (a) and solid-phase method (b).

Fig. S4. Cyclic voltammograms of the C-T-1:1 and C-D-1:1samplesat various scan rates: (a) 20 mV s−1, (b) 50 mV s−1, (c) 100 mV s−1 and (d) 200 mV s−1.

Fig. S5. Galvanostatic charge-discharge curves of the C-T-1:1 and C-D-1:1 samples measured at various current: (a) 1 A g−1 (b) 10 A g−1, (c) 20 A g−1 (d) 40 A g−1.