Selenium encapsulated into 3D interconnected hierarchical porous carbon aerogels (HPCA) as a carbon/selenium composite material is prepared for lithium–selenium batteries. Scanning electron microscope (SEM) and transmission electron microscope (TEM) observations show the hierarchical porous structures of the carbon aerogels and the homogeneous distribution of selenium in the composite. The performance of the HPCA/Se cathode is evaluated in lithium–selenium batteries using cyclic voltammetry, galvanostatic charge–discharge, and electrochemical impedance spectroscopy. It is found that the HPCA/Se cathode shows high rate performance, coulombic efficiency and cycling stability. The HPCA/Se cathode has a highest coulombic efficiency which is kept above 98% after 50th cycle in ionic liquid N-methyl-(n-butyl) pyrrolidinium bis(trifluoromethanesulfonyl)imide (PYR14TFSI) modified electrolyte and retains 309 mAh g−1 after 100 discharge/charge cycles at a high rate of 0.5 C (337.5 mAh g−1) in LiNO3 modified electrolyte, respectively. Even at the current density of 5 C (3375 mAh g−1), it can still maintain at a reversible capacity of 301 mAh g−1. The excellent electrochemical properties benefit from the high electron conductivity and 3D interconnected hierarchical porous structures of the carbon aerogels, which contribute to disperse selenium and absorb polyselenides, and suppress the formation of residual Li2Se layer.