What this simulation shows
Choose a starting mass between half the Sun's and forty times the Sun's, then press Play. The stage follows one star through seven stages, from a cold cloud of gas and dust to its end, and the strip along the bottom tracks its progress. Each stage has its own picture: a swirling cloud, a glowing ball in a dusty disc, a steady star, a swollen giant, then either a glowing shell round a tiny hot dwarf or a blinding explosion. Sizes and colours are drawn for clarity rather than to scale, and the stage says so.
Gravity against pressure
A cloud of gas and dust collapses because its own gravity pulls it inwards. As it shrinks, gravitational potential energy is transferred to the thermal energy store, so the protostar heats up long before any hydrogen fuses. Once the core is hot enough, hydrogen nuclei fuse into helium and release energy. That keeps the core very hot, and the hot gas pushes outwards. On the main sequence the outward push matches gravity's inward pull, which is why the star keeps a steady size for most of its life. The Forces on the star card lets you test this: slow the fusion and gravity wins for a while, so the star shrinks until its squeezed core heats up again.
Two ways to end
Mass decides the ending. A star like the Sun swells into a red giant once its core runs low on hydrogen. Its outer layers later drift away as a planetary nebula, leaving a white dwarf about as big as the Earth, which cools over billions of years. A completely cold black dwarf is only a prediction, since no white dwarf has had time to cool that far. A star above roughly 8 solar masses becomes a red supergiant instead. When its core has turned to iron, fusion can no longer support it: the core collapses in under a second and the star explodes as a supernova. The core survives as a neutron star or, for the heaviest stars, a black hole. The line between those outcomes is blurred, so the simulation shows both from about 20 to 25 solar masses.
Where your atoms were made
The elements card follows the fusion. Main sequence stars turn hydrogen into helium, giants turn helium into carbon and oxygen, and supergiants build layer upon layer up to an iron centre. Fusing iron releases no energy, so this route stops there. For the elements beyond iron, exam answers point to supernovae, and astronomers now know that colliding neutron stars make many as well. Planetary nebulae and supernovae hand all this material back to space, where it can be gathered into new stars and planets.
How long it all takes
The timeline below the stage uses a log scale, because the stages last anywhere from under a second to tens of billions of years. A common rough rule for the main sequence of a star of starting mass is
so heavier stars, despite holding more fuel, use it up far faster. The Sun gets about 10 billion years, a 15 solar mass star only about 11 million. Stars lighter than about 0.9 solar masses have main sequence lives longer than the present age of the universe, so a star like that has not had time to leave the main sequence.
Simplifications and course notes
Every duration and boundary here is approximate. For AQA, this topic sits in GCSE Physics only, and the specification's flow chart runs from red giant straight to white dwarf, so the planetary nebula is extra detail. Cambridge IGCSE puts the whole life cycle in the Supplement, calls the main sequence a stable star and never mentions black dwarfs. The Punjab Class 10 book describes the Sun as a medium-sized star powered by hydrogen fusion but not the life cycle, so treat the rest as extension.