At the core of the sun, gravitational attraction produces immense pressure and temperature, which can reach more than 27 million degrees F (15 million degrees C). Hydrogen atoms get compressed and fuse together, creating helium. This process is called nuclear fusion.
Nuclear fusion produces huge amounts of energy. The energy radiates outward to the sun's surface, atmosphere and beyond. From the core, energy moves to the radiative zone, where it bounces around for up to 1 million years before moving up to the convective zone, the upper layer of the sun's interior. The temperature here drops below 3.5 million degrees F (2 million degrees C). Large bubbles of hot plasma form a soup of ionized atoms and move upwards to the photosphere.
The temperature in the photosphere is about 10,000 degrees F (5,500 degrees C). It is here that the sun's radiation is detected as sunlight. Sunspots on the photosphere are cooler and darker than the surrounding area. At the center of big sunspots the temperature can be as low as 7,300 degrees F (4,000 degrees C).
The chromosphere, the next layer of the sun's atmosphere is a bit cooler — about 7,800 degrees F (4,320 degrees C). Visible light from the chromosphere is usually too weak to be seen against the brighter photosphere, but during total solar eclipses, when the moon covers the photosphere, the chromosphere can be seen as a red rim around the sun.
Temperatures rise dramatically in the corona, which can also only be seen during an eclipse as plasma streams outward like points on a crown. The corona can get about 3.5 million degrees F (2 million degrees C). As the corona cools, losing heat and radiation, matter is blown off as the solar wind.