Neutron stars are extremely dense collapsed stars sometimes left behind after a supernova explosion. They are created when giant stars die in supernovas and their cores collapse, compressing the protons and electrons into neutrons. Neutron stars have a diameter of only 20 kilometers but contain 1.5 times the mass of the Sun concentrated into that small, dense space. White dwarfs are stellar remnants composed mainly of electron-degenerate matter. They have a mass comparable to the Sun's but contained within a volume comparable to Earth's. In the future, as the Sun dies it will expand into a red giant, engulfing the inner planets, before collapsing into a hot, dense white dwarf.
White dwarfs are the burned-out cores of stars that have collapsed into an extremely dense state with no empty space between atoms. They have a mass similar to the sun's but are very small, around the size of Earth. Neutron stars are created during supernova explosions from the central core of a star that collapsed under gravity. They are an extremely compact ball of neutrons that are very hot, small, dense, and have masses higher than the sun's. Both white dwarfs and neutron stars achieve extreme density through electron or quantum degeneracy pressure preventing further gravitational collapse.
All stars begin as clouds of dust and gas called nebulae. When gravity causes the nebula to collapse, a protostar forms at the center. The protostar grows in size and temperature through nuclear fusion reactions until it becomes a stable main sequence star. Small stars like our Sun will eventually expand into red giants and shed their outer layers, leaving behind dense white dwarf cores. Larger stars may explode as supernovae, collapsing into neutron stars or black holes. The life cycle of a star depends on its initial mass, with smaller stars ending as white dwarfs and more massive stars ending as black holes or neutron stars.
The life cycle of stars depends on their mass. Lower mass stars like our Sun will eventually become red giants then white dwarfs. Higher mass stars live shorter lives and end as supernovas, leaving behind neutron stars or black holes. All stars begin as nebulae of dust and gas that collapse under gravity into protostars and main sequence stars fueled by nuclear fusion.