Increasing both the energy density and the power density of supercapacitors is an important but challenging research subject. Porous carbon with extremely high surface, such as activated carbon, is a key engineering material for current supercapacitor technology. Here we report optimized mesopores enabling significantly enhanced rate performance in hierarchically meso-/microporous carbon with a ultrahigh surface area for supercapacitors, which is prepared by a new in-situ template method to exhibit a high mesopore volume proportion (66.0%), as well as a large pore volume up to 2.47cm3 g−1, and an ultrahigh specific surface area of 3122m2 g−1. Polysiloxane was used as a precursor to produce nonporous SiOC, and sequentially NaOH was used to activate SiOC to produce highly porous carbon by removing silica and activating carbon. Hierarchically porous carbon C800 exhibited a high energy density up to 42Whkg−1 at a power density of 374Wkg−1, and still retained an energy density of 21Whkg−1 at a high power density of 30kWkg−1. The superior rate performance of the supercapacitor is attributed to that C800 contains a majority proportion of mesopores which facilitate fast ion migration during high power charging/discharging.