The sun, like all active stars, is a massive hydrogen-burning furnace producing huge amounts of light, heat and radiation, about 4 x 10^26 watts every second. The sun, in fact, is the origin of all energy on the earth, even fossil fuels. The process by which the sun creates and releases energy is called fusion.
Hydrogen is the lightest, most simple element in the universe, consisting of just one proton and one electron. At low temperatures, the positive charge of the hydrogen nuclei repel each other, preventing fusion. However, as a young star condenses, increasing its temperature and pressure, four hydrogen atoms will come in close enough proximity to fuse together into a single atom of helium. In the process, some mass is converted into energy. Hydrogen fusion can begin at 8 million degrees Kelvin. As hydrogen fusion progresses, the star reaches higher and higher temperatures which allow it to fuse heavier elements. Three atoms of helium fuse into a single atom of carbon-12 at 100 million degrees Kelvin.
The energy released by fusion is in the form of gamma rays, small but highly energetic waves of radiation. Their high frequency but small wavelength makes them dangerous to living cells. Fortunately, most fusion occurs in the core of the sun, and before the gamma rays can be released into space, they must pass through the outer layers of the sun. Immediately surrounding the core is the radiation zone, a region so dense that it takes on average 171,000 years, and up to several million years, for energy to escape it. The next layer is the convection zone, where hot plasma close to the core rises while cooler plasma sinks. In the convection zone many gamma rays are further slowed and propagate as photons, particles of visible light, as the energy moves to the surface of the sun.
The photosphere is the region of the sun that contains the visible light. Its temperature is still between 4,500 and 6,000 degrees Kelvin but is significantly cooler than the inner layers. The outermost part of the photosphere is called the corona and is where sunspots and solar prominences occur. Of the energy reaching Earth, about half is visible light and half is in the infrared part of the electromagnetic spectrum. But the most dangerous is the small amount of ultraviolet radiation. Energy escaping the photosphere moves at about the speed of light, taking about eight minutes to reach Earth.