Most stars take millions of years to die. When a star like the Sun has burned all of its hydrogen fuel, it expands to become a red giant. This may be millions of kilometres across - big enough to swallow the planets Mercury and Venus.
After puffing off its outer layers, the star collapses to form a very dense white dwarf. One teaspoon of material from a white dwarf would weigh up to 100 tonnes. Over billions of years, the white dwarf cools and becomes invisible.
Stars heavier than eight times the mass of the Sun end their lives very suddenly. When they run out of fuel, they swell into red supergiants. They try to keep alive by burning different fuels, but this only works for a few million years. Then they blow themselves apart in a huge supernova explosion.
For a week or so, the supernova outshines all of the other stars in its galaxy. Then it quickly fades. All that is left is a tiny, dense object – a neutron star or a black hole – surrounded by an expanding cloud of very hot gas.
The elements made inside the supergiant (such as oxygen, carbon and iron) are scattered through space. This stardust eventually makes other stars and planets.