Stars appear during a sneeze when the back of the eye is stimulated by the force of the sneeze.

It can be upsetting to see things that aren’t there, whether they be lights, shadows or pink elephants, but when people push their closed eyes, get migraines or even sneeze, they can see a variety of phantom lights and flashes.

All of these luminous visions are caused by stimulation of the back of the eye, or the optic nerve, which transmits the experience of light to the brain. As a child, you may remember surreptitiously pressing on your closed eyelids and watching the undulating patterns of light projected into that hot, dark field. As an adult, if you experience a significant increase in flashes or prolonged visual disturbances when you’re not pressing on your eyelids, it could be a sign of retinal detachment, where the retina is pulled away from the back of the eye. This is a serious emergency and should prompt an immediate visit to your doctor.

Flashes and lights in your field of vision can also be associated with migraine headaches, either as part of the pre-migraine aura or as a visual migraine. But other kinds of pressure and stimulation can trick the brain into seeing flashes as well, and most of these visions are common and harmless.

Inside our eyeballs is a thick gel, which keeps the eye nice and round and plump. This gel can rub against the retina, stimulating the part of the eye that creates images in our brain. When the brain gets a message from the retina, it interprets it as light. So whether there is light entering the eye or not, any stimulation of the retina will be translated into a light show by the brain.

If you see stars or flashes after sneezing, it could be from a pressure on the eye itself, or from stimulation of the nerves that have to do with sight. After standing on your head, or getting up quickly after lying down, blood pressure can drop, and the brain can be deprived of oxygen, changing the environment in and around the eye or affecting the optic nerve.

Also when you sneeze, you create pressure in your chest and head, enough pressure to shoot a sneeze out at 100 miles per hour. The retina can be jostled by the strong force of sneezing.

Another set of visual phenomena that can be mistaken for flashes are floaters , caused by disturbances in the gel inside the eye. These blips are usually either clumps of gel or wayward blood cells, and they are most visible when staring at a bright, uniform background, like a blue sky. Floaters multiply with age, as the gel in the eye becomes more and more fluid.

So if you’re otherwise healthy and don’t have problems with migraine headaches, seeing flashes and floaters shouldn’t worry you. Watch out for an increase in either phenomenon or a significant change in vision as signs of retinal detachment, but otherwise, enjoy the show.

This answer is provided by Scienceline, a project of New York University's Science, Health and Environmental Reporting Program.

Follow Life's Little Mysteries on Twitter @llmysteries. We're also on Facebook & Google+.