3D porous carbons have shown great potential in electrochemical energy storage. However, traditional template assisted methods suffer from complicated synthesis processes as well as the difficulty of removing template. In this paper, 3D neat porous carbon aerogels have been designed and synthesized by a green and novel way via self-assembly of hydrogel with NaCl as the template and the flux during in-situ polymerization and carbonization. NaCl can be easily recovered with simple recrystallization in the end of synthesis. The as-synthesized 3D porous carbon aerogels display excellent structural stability, large specific surface area (1665.5 m2 g−1), porous structure centered at microporous (0.71 nm and 1.24 nm) and macropores for ionic diffusion and electrolyte transport, as well as large interlayer spacings (0.386 nm) for sodium storage. When employed as anode materials for sodium-ions batteries, the electrodes exhibit high reversible specific capacity of 287 mAh g−1 at 50 mA g−1 after 100 cycles, superior cycling stability of 154 mAh g−1 at 500 mA g−1 after 1000 cycles as well as excellent rate capability of 139 mAh g−1 at 1000 mA g−1. This work inspires a new strategy in the fabrication of advanced carbon structures for sodium-ion batteries and other applications.