Novel layered 2D frameworks (C3N and C2N-450) with well-defined crystal structures are explored for use as anode materials in lithium-ion batteries (LIBs) for the first time. As anode materials for LIBs, C3N and C2N-450 exhibit unusual electrochemical characteristics. For example, C2N-450 (and C3N) display high reversible capacities of 933.2 (383.3) and 40.1 (179.5) mAh g−1 at 0.1 and 10 C, respectively. Furthermore, C3N shows a low hypothetical voltage (≈0.15 V), efficient operating voltage window with ≈85% of full discharge capacity secured at >0.45 V, and excellent cycling stability for more than 500 cycles. The excellent electrochemical performance (especially of C3N) can be attributed to their inherent 2D polyaniline frameworks, which provide large net positive charge densities, excellent structural stability, and enhanced electronic/ionic conductivity. Stable solid state interface films also form on the surfaces of the 2D materials during the charge/discharge process. These 2D materials with promising electrochemical performance should provide insights to guide the design and development of their analogues for future energy applications.