The hierarchical porous carbon with overall macropores and surface micropores has been prepared from carbonization of chitosan/[Formula: see text][Formula: see text] gel-like composite. The specific surface area and pore volume of this carbon can come to 2358.9[Formula: see text][Formula: see text] g[Formula: see text] and 1.14[Formula: see text]cm3 g[Formula: see text], respectively, and the active component Se with amorphous structure is uniformly encapsulated into the microporous structure to form Se/carbon composite. As Li–Se battery cathode, the composite delivers a second discharge capacity of 537.6[Formula: see text]mAh g[Formula: see text] at 0.2[Formula: see text]C, and a discharge capacity of 517.9[Formula: see text]mA h g[Formula: see text] can be retained after 100 cycles. Even at a high rate of 5[Formula: see text]C, the composite still reveals a stable discharge capacity of 325.2[Formula: see text]mAh g[Formula: see text]. The excellent electrochemical performances of Se/carbon composite may attribute to high specific surface area and hierarchical porous feature.