Free-standing 3D carbonaceous materials offer many advantages and therefore hold great potential for a wide range of applications. However, the synthesis of these materials often involves complicated processes that may lead to low yields and high costs. In this study, this issue is addressed through developing a facile, scalable, and cost-effective synthesis strategy. Nitrogen-doped hierarchically porous carbon foam (HP-CF) is fabricated by annealing of soft-template-casted melamine foam, and its application for supercapacitors is highlighted. The HP-CF integrates a large number of macropores and micropores, thus providing sufficient space for ion transport while offering a large amount of surface sites for energy storage, thanks to which the HP-CF exhibits a high capacitance of 238Fg–1 (or 11.9Fcm–3). In addition, the HP-CF performs greatly when acting as the mechanical support for pseudocapacitive materials such as NiCo2S4 and Fe2O3, based on which an asymmetric supercapacitor (ASC, can also be described as aqueous battery) is assembled. The ASC exhibits a high energy density of 93.9Whkg–1 (or 3.55mWhcm–3) and a high power density of 21.1kWkg–1 (or 799mWcm–3), among the highest reported values for ASCs.