After core hydrogen exhaustion
The Sun does not have enough mass toexplode as a supernova. Instead, when it runs out of hydrogen in thecore in approximately 5 billion years, core hydrogen fusion willstop, and there will be nothing to prevent the core from contracting.The release of gravitational potential energy will cause theluminosity of the Sun to increase, ending the main sequence phase andleading the Sun to expand over the next billion years: first into asub-giant, and then into a red giant. The heating due togravitational contraction will also lead to hydrogen fusion in ashell just outside the core, where unfused hydrogen remains,contributing to the increased luminosity, which will eventually reachmore than 1,000 times its present luminosity. When the Sun enters itsred-giant branch (RGB) phase, it will engulf Mercury and (likely)Venus, reaching about 0.75 AU (110 million km; 70 million mi). TheSun will spend around a billion years in the RGB and lose around athird of its mass.
After the red-giant branch, the Sun hasapproximately 120 million years of active life left, but muchhappens. First, the core (full of degenerate helium) ignitesviolently in the helium flash; it is estimated that 6% of thecore—itself 40% of the Sun's mass—will be converted into carbonwithin a matter of minutes through the triple-alpha process. The Sunthen shrinks to around 10 times its current size and 50 times theluminosity, with a temperature a little lower than today. It willthen have reached the red clump or horizontal branch, but a star ofthe Sun's metallicity does not evolve blue-ward along the horizontalbranch. Instead, it just becomes moderately larger and more luminousover about 100 million years as it continues to react helium in thecore.
When the helium is exhausted, the Sunwill repeat the expansion it followed when the hydrogen in the corewas exhausted. This time, however, it all happens faster, and the Sunbecomes larger and more luminous, engulfing Venus if it has notalready. This is the asymptotic-giant-branch phase, and the Sun isalternately reacting hydrogen in a shell or helium in a deeper shell.After about 20 million years on the early asymptotic giant branch,the Sun becomes increasingly unstable, with rapid mass loss andthermal pulses that increase the size and luminosity for a fewhundred years every 100,000 years or so. The thermal pulses becomelarger each time, with the later pulses pushing the luminosity to asmuch as 5,000 times the current level and the radius to over 1 AU(150 million km; 93 million mi).
According to a 2008 model, Earth'sorbit will have initially expanded to at most 1.5 AU (220 million km;140 million mi) due to the Sun's loss of mass as a red giant.However, Earth's orbit will later start shrinking due to tidal forces(and, eventually, drag from the lower chromosphere) so that it isengulfed by the Sun during the tip of the red-giant branch phase, 3.8and 1 million years after Mercury and Venus have respectivelysuffered the same fate. Models vary depending on the rate and timingof mass loss. Models that have higher mass loss on the red-giantbranch produce smaller, less luminous stars at the tip of theasymptotic giant branch, perhaps only 2,000 times the luminosity andless than 200 times the radius. For the Sun, four thermal pulses arepredicted before it completely loses its outer envelope and starts tomake a planetary nebula. By the end of that phase—lastingapproximately 500,000 years—the Sun will only have about half ofits current mass.
The post-asymptotic-giant-branchevolution is even faster. The luminosity stays approximately constantas the temperature increases, with the ejected half of the Sun's massbecoming ionized into a planetary nebula as the exposed core reaches30,000 K (29,700 °C; 53,500 °F), as if it is in a sort of blueloop. The final naked core, a white dwarf, will have a temperature ofover 100,000 K (100,000 °C; 180,000 °F), and contain an estimated54.05% of the Sun's present-day mass. The planetary nebula willdisperse in about 10,000 years, but the white dwarf will survive fortrillions of years before fading to a hypothetical black dwarf.