Further contraction of the core increases the temperature to 108 kelvin, at which stage the star can convert its helium core into carbon through the triple alpha process. The sudden onset of helium burning – the helium flash – may disturb the equilibrium of a low-mass star. The triple alpha reaction gives out less energy than hydrogen fusion and soon the star finds itself once again without a nuclear energy source. Further contraction may result in helium-shell burning but it is doubtful if low-mass stars have sufficient gravitational energy to go further than this stage. The star becomes a red giant again, pulsating and varying in its brightness because of the vast extent of its atmosphere (see pulsating variables). Eventually the atmosphere gently drifts away from the compact core of the star with velocities of only a few km s–1, resulting in the formation of a planetary nebula. The collapsed core forms a white dwarf star, which continues to radiate its heat away into space for several millions of years.
Stars more than twice as massive as the Sun convert hydrogen to helium through the carbon cycle, which makes their cores fully convective and therefore less dense than solar-mass stars. Their main-sequence lifetime decreases with increasing mass; it is only about 40 million years for a star of 8 solar masses and a few million years for the most massive stars. When they exhaust their hydrogen, the onset of helium burning occurs only gradually: this is because the core is nondegenerate, and so no instabilities arise. Having consumed its helium, a massive star has the potential energy to contract further so that carbon – formed by the triple alpha process – can burn to oxygen, neon, and magnesium (see nucleosynthesis). Should the star be sufficiently massive, it will build elements up to iron in its interior. But iron is at the limit of nuclear-fusion reactions and further contraction of a massive star's core can only result in catastrophic collapse, leading to a supernova explosion. The core collapses to become a neutron star or black hole.