linguistic:voice_change
After core hydrogen exhaustion

The Sun does not have enough mass to explode as a supernova. Instead, when it runs out of hydrogen in the core in approximately 5 billion years, core hydrogen fusion will stop, and there will be nothing to prevent the core from contracting. The release of gravitational potential energy will cause the luminosity of the Sun to increase, ending the main sequence phase and leading the Sun to expand over the next billion years: first into a subgiant, and then into a red giant. The heating due to gravitational contraction will also lead to expansion of the Sun and hydrogen fusion in a shell just outside the core, where unfused hydrogen remains, contributing to the increased luminosity, which will eventually reach more than 1,000 times its present luminosity. When the Sun enters its red-giant branch (RGB) phase, it will engulf (and very likely destroy) Mercury and Venus. According to a 2008 paper, Earth's orbit will have initially expanded to at most 1.5 AU (220 million km; 140 million mi) due to the Sun's loss of mass. However, Earth's orbit will then start shrinking due to tidal forces (and, eventually, drag from the lower chromosphere) so that it is engulfed by the Sun during the tip of the red-giant branch phase 7.59 billion years from now, 3.8 and 1 million years after Mercury and Venus have respectively suffered the same fate.

By the time the Sun reaches the tip of the red-giant branch, it will be about 256 times larger than it is today, with a radius of 1.19 AU (178 million km; 111 million mi). The Sun will spend around a billion years in the RGB and lose around a third of its mass.

After the red-giant branch, the Sun has approximately 120 million years of active life left, but much happens. First, the core (full of degenerate helium) ignites violently in the helium flash; it is estimated that 6% of the core—itself 40% of the Sun's mass—will be converted into carbon within a matter of minutes through the triple-alpha process. The Sun then shrinks to around 10 times its current size and 50 times the luminosity, with a temperature a little lower than today. It will then have reached the red clump or horizontal branch, but a star of the Sun's metallicity does not evolve blueward along the horizontal branch. Instead, it just becomes moderately larger and more luminous over about 100 million years as it continues to react helium in the core.

When the helium is exhausted, the Sun will repeat the expansion it followed when the hydrogen in the core was exhausted. This time, however, it all happens faster, and the Sun becomes larger and more luminous. This is the asymptotic-giant-branch phase, and the Sun is alternately 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 and thermal pulses that increase the size and luminosity for a few hundred years every 100,000 years or so. The thermal pulses become larger each time, with the later pulses pushing the luminosity to as much as 5,000 times the current level. Despite this, the Sun's maximum AGB radius will not be as large as its tip-RGB maximum: 179 R, or about 0.832 AU (124.5 million km; 77.3 million mi).

Models vary depending on the rate and timing of mass loss. Models that have higher mass loss on the red-giant branch produce smaller, less luminous stars at the tip of the asymptotic giant branch, perhaps only 2,000 times the luminosity and less than 200 times the radius. For the Sun, four thermal pulses are predicted before it completely loses its outer envelope and starts to make a planetary nebula.

The post-asymptotic-giant-branch evolution is even faster. The luminosity stays approximately constant as the temperature increases, with the ejected half of the Sun's mass becoming ionized into a planetary nebula as the exposed core reaches 30,000 K (53,500 °F), as if it is in a sort of blue loop. The final naked core, a white dwarf, will have a temperature of over 100,000 K (180,000 °F) and contain an estimated 54.05% of the Sun's present-day mass. (Simulations indicate that the Sun may be among the least massive stars capable of forming a planetary nebula.) The planetary nebula will disperse in about 10,000 years, but the white dwarf will survive for trillions of years before fading to a hypothetical super-dense black dwarf. As such, it would give off no more energy for an even longer time than it was a white dwarf.