The Sun was formed about 4.57 billion years ago when a hydrogen molecular cloud collapsed. Solar formation is dated in two ways: the Sun's current main sequence age, determined using computer models of stellar evolution and nucleocosmochronology, is thought to be about 4.57 billion years. This is in close accord with the radiometric date of the oldest Solar System material, at 4.567 billion years ago.
The Sun is about halfway through its main-sequence evolution, during which nuclear fusion reactions in its core fuse hydrogen into helium. Each second, more than four million metric tons of matter are converted into energy within the Sun's core, producing neutrinos and solar radiation. At this rate, the Sun has so far converted around 100 Earth-masses of matter into energy. The Sun will spend a total of approximately 10 billion years as a main sequence star.
The Sun does not have enough mass to explode as a supernova. Instead, in about 5 billion years, it will enter a red giant phase, its outer layers expanding as the hydrogen fuel in the core is consumed and the core contracts and heats up. Helium fusion will begin when the core temperature reaches around 100 million K and will produce carbon, entering the asymptotic giant branch phase.
Earth's fate is precarious. As a red giant, the Sun will have a maximum radius beyond the Earth's current orbit, 1 AU (1.5×1011 m), 250 times the present radius of the Sun. However, by the time it is an asymptotic giant branch star, the Sun will have lost roughly 30% of its present mass due to a stellar wind, so the orbits of the planets will move outward. If it were only for this, Earth would probably be spared, but new research suggests that Earth will be swallowed by the Sun owing to tidal interactions. Even if Earth would escape incineration in the Sun, still all its water will be boiled away and most of its atmosphere would escape into space. Even during its current life in the main sequence, the Sun is gradually becoming more luminous (about 10% every 1 billion years), and its surface temperature is slowly rising. The Sun used to be fainter in the past, which is possibly the reason life on Earth has only existed for about 1 billion years on land. The increase in solar temperatures is such that in about another billion years the surface of the Earth will likely become too hot for liquid water to exist, ending all terrestrial life.
Following the red giant phase, intense thermal pulsations will cause the Sun to throw off its outer layers, forming a planetary nebula. The only object that will remain after the outer layers are ejected is the extremely hot stellar core, which will slowly cool and fade as a white dwarf over many billions of years. This stellar evolution scenario is typical of low- to medium-mass stars.