A unique decomposition pathway of urea involving gas evolution was exploited as a way to introduce voids and mesopores into one-dimensional carbon nanofibers. While the conventional carbonization of electrospun polyacrylonitrile (PAN) nanofibers produces microporous and solid carbon nanofibers, adding a simple step involving a urea coating over PAN prior to the carbonization drastically changes the porous structure of the resulting carbon nanofibers. Besides its role as a porogen for the creation of voids and mesopores, urea serves as an additional nitrogen source for the carbon nanofibers, and as a consequence, heavily nitrogen-doped carbon fibers are produced. Compared with conventional carbon nanofibers derived from the pyrolysis of electrospun PAN, hollow carbon nanofibers are superior in lithium-ion battery applications because of their larger specific surface area, higher nitrogen doping, and voids combined with mesopores that are beneficial for lithium-ion (de-) intercalation. Due to its versatility and simplicity, this urea-assisted template-less synthesis strategy paves a new way for the production of various porous carbon nanostructures.