A solar flare is a sudden flash of brightness observed over the Sun's surface or the solar limb, which is interpreted as a large energy release of up to 6 × 1025 joules of energy (about a sixth of the total energy output of the Sun each second or 160,000,000,000 megatons of TNT equivalent, over 25,000 times more energy than released from the impact of Comet Shoemaker–Levy 9 with Jupiter). They are often, but not always, followed by a colossal coronal mass ejection. The flare ejects clouds of electrons, ions, and atoms through the corona of the sun into space. These clouds typically reach Earth a day or two after the event. The term is also used to refer to similar phenomena in other stars, where the term stellar flare applies.Solar flares affect all layers of the solar atmosphere (photosphere, chromosphere, and corona), when the plasma medium is heated to tens of millions of kelvin, while the electrons, protons, and heavier ions are accelerated to near the speed of light. They produce radiation across the electromagnetic spectrum at all wavelengths, from radio waves to gamma rays, although most of the energy is spread over frequencies outside the visual range and for this reason the majority of the flares are not visible to the naked eye and must be observed with special instruments. Flares occur in active regions around sunspots, where intense magnetic fields penetrate the photosphere to link the corona to the solar interior. Flares are powered by the sudden (timescales of minutes to tens of minutes) release of magnetic energy stored in the corona. The same energy releases may produce coronal mass ejections (CME), although the relation between CMEs and flares is still not well established.