Hierarchically porous carbon (HPC) materials with interconnected porous texture are produced from a porous poly(divinylbenzene) precursor, which is synthesized by polymerizing high-internal-phase emulsions. After carbonation, the macroporous structures of the poly(divinylbenzene) precursor are preserved and enormous micro-/mesopores via carbonation with KOH are produced, resulting in an interconnected hierarchically porous network. The prepared HPC has a maximum specific surface area of 2189 m2 g-1. The electrode materials for supercapacitors and capacitive deionization devices employing the formed HPC exhibit a high specific capacity of 88 mA h g-1 through a voltage range of 1 V (319 F g-1 at 1 A g-1) and a superior electrosorption capacity of 21.3 mg g-1 in 500 mg L-1 NaCl solution. The excellent capacitive performance could be ascribed to the combination of high specific surface area and favorable hierarchically porous structure.