The coincidence of the Late Heavy Bombardment (LHB) period and the emergence of terrestrial life about 4 billion years ago suggest that extraterrestrial impacts could contribute to the synthesis of the building blocks of the first life-giving molecules. We simulated the high-energy synthesis of nucleobases from formamide during the impact of an extraterrestrial body. A high-power laser has been used to induce the dielectric breakdown of the plasma produced by the impact. The results demonstrate that the initial dissociation of the formamide molecule could produce a large amount of highly reactive CN and NH radicals, which could further react with formamide to produce adenine, guanine, cytosine, and uracil. Based on GC-MS, high-resolution FTIR spectroscopic results, as well as theoretical calculations, we present a comprehensive mechanistic model, which accounts for all steps taking place in the studied impact chemistry. Our findings thus demonstrate that extraterrestrial impacts, which were one order of magnitude more abundant during the LHB period than before and after, could not only destroy the existing ancient life forms, but could also contribute to the creation of biogenic molecules.