The carbonization mechanism in polyacrylonitrile (PAN) based carbon nanofibers is studied using ReaxFF molecular dynamics simulations. Simulations are performed at two carbonization temperatures, 2500 and 2800 K, and also at two densities, 1.6 and 2.1 g/cm(3), that are relevant to the experimental carbonization conditions. The results are analyzed by examining the evolution of species with time, including carbon-only ring structures and gaseous species. Formation mechanisms are proposed for species like N(2), H(2), NH(3), and HCN and five-, six-, and seven-membered carbon-only rings, along with polycyclic structures. Interestingly, the formation of five-membered rings follows N(2) formation and usually occurs as a precursor to six-membered rings. Elimination mechanisms for the gaseous molecules are found that are in agreement with previously proposed mechanisms; however, alternative mechanisms are also proposed.