text: Carbon-14 is produced in the upper troposphere and the stratosphere by thermal neutrons absorbed by nitrogen atoms. When cosmic rays enter the atmosphere, they undergo various transformations, including the production of neutrons. The resulting neutrons (n) participate in the following n-p reaction (p is proton):
  : + n →  + p
  The highest rate of carbon-14 production takes place at altitudes of  and at high geomagnetic latitudes.
  The rate of  production can be modelled, yielding values of 16,400 or 18,800 atoms of  per second per square meter of the Earths surface, which agrees with the global carbon budget that can be used to backtrack, but attempts to measure the production time directly in situ were not very successful. Production rates vary because of changes to the cosmic ray flux caused by the heliospheric modulation (solar wind and solar magnetic field), and, of great significance, due to variations in the Earths magnetic field. Changes in the carbon cycle however can make such effects difficult to isolate and quantify.
  Occasional spikes may occur; for example, there is evidence for an unusually high production rate in AD 774–775, caused by an extreme
  solar energetic particle event, the strongest such event to have occurred within the last ten millennia. Another "extraordinarily large"  increase (2%) has been associated with a 5480 BC event, which is unlikely to be a solar energetic particle event.
  Carbon-14 may also be produced by lightning but in amounts negligible, globally, compared to cosmic ray production. Local effects of cloud-ground discharge through sample residues are unclear, but possibly significant.