All stars begin as nebulae of dust and gas that collapse under gravity into protostars. They fuse hydrogen into helium during the main sequence stage, which is the longest phase in a star's life. A star's ultimate fate depends on its mass. Small mass stars become white dwarfs after the main sequence, while medium mass stars become red giants then white dwarfs. Large mass stars over 15 solar masses may explode as supernovae, leaving behind neutron stars or black holes.