The Sun is the star at the center of the Solar System. It is almost spherical and consists of hot plasma interwoven with magnetic fields. It has a diameter of about 1,392,684 km (865,374 mi), around 109 times that of Earth, and its mass (1.989×1030 kilograms, approximately 330,000 times the mass of Earth (M⊕)) accounts for about 99.86% of the total mass of the Solar System. Chemically, about three quarters of the Sun's mass consists of hydrogen, whereas the rest is mostly helium. The remaining 1.69% (equal to 5,600 M⊕) consists of heavier elements, including oxygen, carbon, neon and iron, among others.
The Sun formed about 4.567 billion years ago from the gravitational collapse of a region within a large molecular cloud. Most of the matter gathered in the center, whereas the rest flattened into an orbiting disk that would become the Solar System. The central mass became increasingly hot and dense, eventually initiating thermonuclear fusion in its core. It is thought that almost all stars form by this process. The Sun is a G-type main-sequence star (G2V) based on spectral class and it is informally designated as a yellow dwarf because its visible radiation is most intense in the yellow-green portion of the spectrum. The Sun's color is white, with a CIE near (0.3, 0.3), when viewed from space or when high in the sky; when low in the sky, atmospheric scatteringrenders the Sun yellow, red, orange, or magenta. Despite its typical whiteness, most people mentally picture the Sun as yellow; the reasons for this are the subject of debate. In the spectral class label, G2 indicates its surface temperature, of approximately 5778 K (5505 °C, 9941 °F), and V indicates that the Sun, like most stars, is a main-sequence star, and thus generates its energy by nuclear fusion of hydrogen nuclei into helium. In its core, the Sun fuses about 620 million metric tons of hydrogen each second.