N/B co‐doped nanocarbon (NBC) is emerging as promising candidate in various applications. However, most synthetic approaches require complex heteroatom/carbon precursors, and suffer from poor porosity control and inevitable formation of electrochemically inactive N─B bonded species. In this study, we propose a new route to produce NBC from a single copolymer precursor, polyacrylonitrile‐b‐poly(styrene boronic ester) (PAN‐b‐PSBpin). Both polymeric blocks play dual roles during pyrolysis, i.e., PAN serves as both a carbon source and nitrogen source, and PSBpin functions as both a boron source and porogenic block. Importantly, a linear relationship between mesopore size in NBC and block length in copolymers was observed, allowing for excellent porosity control in NBC. X‐ray photoelectron spectroscopy revealed only separated N and B configurations in formed NBC, assuring highly active surface examined by an efficient four‐electron transfer process in oxygen reduction reaction and large geometric capacitances (Csa = 68 μF cm−2 and Cvol = 750 F cm−3) in supercapacitors. © 2020 Wiley Periodicals, Inc. J. Polym. Sci. 2020, 58, 225–232