Introduction
A neutron star is the collapsed core of a giant star which before collapse had a total mass of between 10 and 29 solar masses. Neutron stars are the smallest and densest stars, excluding black holes and hypothetical white holes, quark stars, and strange stars. Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses. They result from the supernova explosion of a massive star, combined with gravitational collapse, that compresses the core past white dwarf star density to that of atomic nuclei.

Formation
Any main-sequence star with an initial mass of above 8 times the mass of the sun (8 M☉) has the potential to produce a neutron star. As the star evolves away from the main sequence, subsequent nuclear burning produces an iron-rich core. When all nuclear fuel in the core has been exhausted, the core must be supported by degeneracy pressure alone. Further deposits of mass from shell burning cause the core to exceed the Chandrasekhar limit. Electron-degeneracy pressure is overcome and the core collapses further, sending temperatures soaring to over 5×109 K. At these temperatures, photodisintegration (the breaking up of iron nuclei into alpha particles by high-energy gamma rays) occurs. As the temperature climbs even higher, electrons and protons combine to form neutrons via electron capture, releasing a flood of neutrinos. When densities reach nuclear density of 4×1017 kg/m3, a combination of strong force repulsion and neutron degeneracy pressure halts the contraction. The infalling outer envelope of the star is halted and flung outwards by a flux of neutrinos produced in the creation of the neutrons, becoming a supernova. The remnant left is a neutron star. If the remnant has a mass greater than about 3 M☉, it collapses further to become a black hole.
Properties
Mass and temperature
A neutron star has a mass of at least 1.1 solar masses (M☉). The upper limit of mass for a neutron star is called the Tolman–Oppenheimer–Volkoff limit and is generally held to be around 2.1 M☉, but a recent estimate puts the upper limit at 2.16 M☉. The maximum observed mass of neutron stars is about 2.14 M☉ for PSR J0740+6620 discovered in September, 2019. Compact stars below the Chandrasekhar limit of 1.39 M☉ are generally white dwarfs whereas compact stars with a mass between 1.4 M☉ and 2.16 M☉ are expected to be neutron stars, but there is an interval of a few tenths of a solar mass where the masses of low-mass neutron stars and high-mass white dwarfs can overlap. It is thought that beyond 2.16 M☉ the stellar remnant will overcome the strong force repulsion and neutron degeneracy pressure so that gravitational collapse will occur to produce a black hole, but the smallest observed mass of a stellar black hole is about 5 M☉. Between 2.16 M☉ and 5 M☉, hypothetical intermediate-mass stars such as quark stars and electroweak stars have been proposed, but none have been shown to exist.
Density and pressure
Neutron stars have overall densities of 3.7×1017 to 5.9×1017 kg/m3 (2.6×1014 to 4.1×1014 times the density of the Sun), which is comparable to the approximate density of an atomic nucleus of 3×1017 kg/m3. The neutron star's density varies from about 1×109 kg/m3 in the crust—increasing with depth—to about 6×1017 or 8×1017 kg/m3 (denser than an atomic nucleus) deeper inside. A neutron star is so dense that one teaspoon (5 milliliters) of its material would have a mass over 5.5×1012 kg, about 900 times the mass of the Great Pyramid of Giza. In the enormous gravitational field of a neutron star, that teaspoon of material would weigh 1.1×1025 N, which is 15 times what the Moon would weigh if it were placed on the surface of the Earth. The entire mass of the Earth at neutron star density would fit into a sphere of 305 m in diameter (the size of the Arecibo Observatory). The pressure increases from 3.2×1031 to 1.6×1034 Pa from the inner crust to the center.