A phosphene is an optical phenomenon that is characterized by perceiving light when there is no light entering the eye. It is an entoptic phenomenon, meaning that the source of it lies within the eye or visual system itself. A phosphene is most often induced by some kind of direct stimulation of the retina, whether mechanical, magnetic or electrical. The random discharge of an electrical signal from a single cell within the visual system can also cause a phosphene.
In addition to the causes already mentioned, it is not uncommon for this phenomenon to be experienced by someone who has gone a long time without visual stimulus. This has given phosphene the nickname of "prisoner's cinema." People who are under the influence of hallucinogenic drugs also report seeing these types of lights, but they are not to be confused with hallucinations, which take place solely in the brain rather than the eye.
Pressure phosphenes are the most common type, and these occur when mechanical pressure is placed on the retina, such as by rubbing the eyes. A pressure phosphene usually persists only while rubbing the eyes and for a short time after. These effects were detailed by the ancient Greeks and Isaac Newton, among others. Another common phosphene related to this first type is the kind that happens following a blow to the head or a heavy sneeze. When we see "stars" in these situations, it is due partially to retinal stimulation, as well as stimulation of other areas of the visual system, including the visual cortex of the brain.
Phosphenes that are electrically or magnetically induced are less common. Electrically induced phosphenes usually only occur in controlled situations, and the first ones were created this way in 1928. More recently, researchers have developed methods to electrically produce phosphenes in those who have been blinded as a result of an accident — in other words, whose brains are still able to process visual information.
Intense magnetic fields have been known to produce phosphenes as well. A procedure called transcranial magnetic stimulation is one way in which magnetic fields can be used to excite nerve cells in the brain to produce phosphenes. Different parts of the visual system can be stimulated depending on exactly where and how the magnetic field is placed. It has also been reported that astronauts sometimes experience phosphenes in space, presumably due to the higher levels of radiation present in space, compared to on Earth.