As one of the most potential electrode materials for supercapacitors, nitrogen-enriched nanocarbons are still facing challenge of constructing developed mesoporosity for rapid mass transportation and tailoring their pore size for performance optimization and expanding their application scopes. Herein we develop a series of nitrogen-enriched mesoporous carbon (NMC) with extremely high mesoporosity and tunable mesopore size by a two-step method using silica gel as template. In our approach, mesopore size can be easily tailored from 4.7 to 35 nm by increasing the HF/TEOS volume ratio from 1/100 to 1/4. The NMC with mesopores of 6.2 nm presents the largest mesopore volume, surface area and mesopore ratio of 2.56 cm3 g−1, 1003 m2 g−1 and 97.7%, respectively. As a result, the highest specific capacitance of 325 F g−1 can be obtained at the current density of 0.1 A g−1, which can stay over 88% (286 F g−1) as the current density increases by 100 times (10 A g−1). This approach may open the doors for preparation of nitrogen-enriched nanocarbons with desired nanostructure for numerous applications.