Nonlinear optical (NLO) materials are useful for applications varying from modulation of optical signals to cancer therapy. Besides inorganic crystals and organic molecules with defined structures, carbonized products have emerged as a new generation of materials showing good NLO properties. Due to the small sizes, the NLO performance of such materials mainly originates from nonlinear absorption. Obtaining a product with a high content of π-conjugated moiety is the key to improving the NLO performance. By using aldehydes bearing π units as the precursors, in this work we synthesized three polymeric nanoparticles (PNPs) through one-step pyrolysis, which also have large contents of π-conjugated structures. It was found that a larger size of π unit in the precursor led to a higher content as well as the size of the π-conjugated structure, which induced a bathochromic shift in the emission and an improved performance in the NLO response. When embedded in polymethylmethacrylate films, the products showed reverse saturable absorption (RSA) behavior with β up to 4.20 × 10−6 m W−1 and optical limit threshold down to 0.0012 J cm−2, which are comparable to those of metal-doped counterparts. This work gives deep insight on the structure-property relationship of the pyrolyzed products from π-conjugated small molecules, which is also useful for the preparation of task-specific carbon dots (CDs) or PNPs in future.