This study prepares highly porous carbon (c-fPI) for lithium-ion battery anode that starts from the synthesis of fluorinated polyimide (fPI) via a step polymerization, followed by carbonization. During the carbonization of fPI, the decomposition of fPI releases gases which are particularly from fluorine-containing moiety (–CF3) of fPI, creating well-defined microporous structure with small graphitic regions and a high specific surface area of 934.35 m2 g− 1. In particular, the graphitic region of c-fPI enables lithiation–delithiation processes and the high surface area can accommodate charges at electrolyte/electrode interface during charge–discharge, both of which contribute electrochemical performances. As a result, c-fPI shows high specific capacity of 248 mAh g− 1 at 25 mA g− 1, good rate-retention performance, and considerable cycle stability for at least 300 charge–discharge cycles. The concept of using a polymeric precursor (fPI), capable of forming considerable pores during carbonization is suitable for the use in various applications, particularly in energy storage systems, advancing materials science and energy technologies.