A planetary nebula, often abbreviated as PN or plural PNe, is a kind of emission nebula consisting of an expanding, glowing shell of ionized gas ejected from old red giant stars late in their lives. The word "nebula" is Latin for mist or cloud, and the term "planetary nebula" is a misnomer that originated in the 1780s with astronomer William Herschel because when viewed through his telescope, these objects resemble the rounded shapes of planets. Herschel's name for these objects was popularly adopted and has not been changed. They are a relatively short-lived phenomenon, lasting a few tens of thousands of years, compared to a typical stellar lifetime of several billion years.
A mechanism for formation of most planetary nebulae is thought to be the following: at the end of the star's life, during the red-giant phase, the outer layers of the star are expelled by strong stellar winds. After most of the red giant's atmosphere is dissipated, the ultraviolet radiation of the hot luminous core, called a planetary nebula nucleus (PNN), ionizes the outer layers earlier ejected from the star. Absorbed ultraviolet light energises the shell of nebulous gas around the central star, causing it to appear as a brightly coloured planetary nebula.
Planetary nebulae likely play a crucial role in the chemical evolution of the Milky Way by expelling elements to the interstellar medium from stars where those elements were created. Planetary nebulae are also observed in more distant galaxies, yielding useful information about their chemical abundances.
Starting from the 1990s, Hubble Space Telescope images have revealed many planetary nebulae to have extremely complex and varied morphologies. About one-fifth are roughly spherical, but the majority are not spherically symmetric. The mechanisms that produce such a wide variety of shapes and features are not yet well understood, but binary central stars, stellar winds and magnetic fields may play a role.