Sun is a star. A spherical ball of plasma which mostly consists of hydrogen, which is being converted into helium within its core. Heavier elements like oxygen, carbon, neon, and iron, are also present but in smaller quantities
There are billions of stars in our galaxy and Sun is just one of them. Stars have been classified based on their spectral types and the Sun is a G-type main sequence star. We also call it as a yellow dwarf.
It has a diameter 109 times, and mass 330,000 times that of Earth. What we receive as light or heat/energy starts from its core as a result of the fusion reaction. It converts more than 4 million tonnes of matter per second within its core.It is a giant generator which has been same for past 4 billion years and will remain same for about 5 billion years more.

It has become hotter than before. As its core is contracting over time, because the hydrogen is converted into helium which thus occupies less volume, outer layers push inwards which in turn increases the rate of fusion. Its brightness increases by 1% over a period of 100 million years.
What is supposed to happen when this generator will use all of its fuel?
The Sun will undergo some changes. The changes that happen during the final stage of a star depend on the mass of the star when it is about to reach its end. A more massive star would have exploded as a supernova. A supernova explosion occurs when the gravitational collapse of a dying star cause it to explode at once and this kind of explosion can outshine millions of stars put together.

In our Sun, the outward pressure generated by the fusion is balanced by the gravity acting inwards. When the hydrogen at its core is exhausted, the core will contract. The hydrogen present in a shell around the core will cause the fusion reaction to resuming but the contracted core increase the reaction rates and thus the temperature will also increase. This will lead to the expansion of the outer layers and now the energy will be spread across a larger surface area and star’s(Sun’s) visible light output will shift towards the red.

Its size can engulf orbits of Mercury, Venus, and even Earth.
A complete collapse of the core occurs in the case of a red giant depending upon its mass. But in the case of Sun electron degeneracy pressure will stop the core to collapse entirely. Degenerate matter means noninteracting particles. Once the core is degenerate the temperature will reach 108 K which will lead to fusion of helium, forming carbon.This process is also called as “helium flash” because it all happens at once.
The insufficient temperature will not allow the fusion of carbon. Star will shed its outer layers(planetary nebula) leaving behind its core.You can see the time period of this process in the image below.

The star will now be called as a white dwarf,also known as a degenerate dwarf.
Featured image credits – Solar Dynamic Observatory.