Carbon materials containing pyridinic nitrogen are expected to be effective for electrodes and catalysts. However, it is challenging to selectively and simultaneously introduce both pyridinic nitrogen and C–H groups next to the pyridinic nitrogen at a high content, which has been reported to work as an active site for oxygen reduction reaction, in the absence of catalysts. In this work, among six relatively inexpensive precursors with pyridinic N and two-fused rings, 1,5-naphthyridine showed the highest percentage of pyridinic nitrogen (80%) and the highest pyridinic-nitrogen content (12.4 at%) after carbonization in an ampoule at 873 K. Unlike carbon materials prepared from precursors with three- or more-fused rings, C–H groups next to pyridinic nitrogen remained in carbonized 1,5-naphthyridine with two-fused rings. Carbonization mechanisms of precursors with two-fused rings were quite different from those of precursors with three- or more-fused rings because of the low thermal stability of the precursors with two-fused rings as results of energy calculation and ReaxFF. The highest percentage and content of pyridinic nitrogen were attained using 1,5-naphthyridine because 1,5-naphthyridine had the highest thermal stability of C–N bonds and the low probability to form tertiary nitrogen among precursors with two-fused rings.