A star may be hundreds or thousands of light-years away. We cannot bottle its atmosphere, yet astronomers can identify hydrogen, helium, iron and other elements in it. The trick is to stop treating starlight as one color. Spread it out, and the light becomes a record of how atoms inside the star handled specific packets of energy. [1][2]
Turn one point of light into a rainbow
A spectrograph uses a prism, diffraction grating or related optics to separate incoming light by wavelength. A detector then measures how bright the star is at each wavelength. The broad shape of this spectrum is linked to temperature: hotter stars radiate more strongly at shorter wavelengths and appear bluer, while cooler stars peak farther toward the red. [3]
But the smooth rainbow is crossed by narrow dark gaps called absorption lines. Light generated deeper inside a star passes through cooler gas above it. Atoms in that gas remove photons at particular wavelengths, leaving an intricate pattern in the emerging spectrum. [2][3]
The missing colors are the message
Those wavelengths are not arbitrary. Electrons in an atom can occupy only specific energy levels. A photon is absorbed when its energy matches an allowed jump between two levels. Because every element has a different arrangement of electrons, each produces a characteristic set of lines. Hydrogen, for example, has visible absorption lines near 410, 434, 486 and 656 nanometres. [2]
Astronomers compare a star’s lines with spectra measured in laboratories and tabulated in reference databases. Matching several lines can identify an element; their strengths help estimate how much is present. This method was powerful enough for helium to be recognized in the Sun’s spectrum before it was isolated on Earth. [3][5][6]
One spectrum, several messages
The same spectrum carries several messages at once. The overall color distribution constrains temperature. Line patterns reveal composition and conditions such as temperature and pressure. If every line shifts toward longer wavelengths, the star is moving away; a shift toward shorter wavelengths means it is approaching. Repeating that measurement can even reveal the small wobble caused by an orbiting planet. [1][4][5]
Why the answer is still an inference
A spectrum is not a scoop taken from a star’s center. It mainly describes the layers from which the observed light escaped, and line strength changes with temperature, pressure and ionization as well as abundance. Lines can overlap, faint elements can fall below an instrument’s sensitivity, and dust or gas between the star and telescope can add features. Astronomers therefore fit many lines and physical models together rather than declaring an ingredient from one dark mark. [2][3][5]
What to keep in mind
Spectroscopy infers composition from light and models; it does not directly sample a star. Results depend on data quality, wavelength coverage and assumptions about the star’s atmosphere, so reported abundances carry uncertainties.
Sources & context
Numbered references link the explanation to its sources. Hypothetical examples and visual metaphors are labelled in the text. Checked 9 November 2026.
- [1] NASA Science — Spectroscopy 101: Introduction
- [2] NASA Science — How Absorption and Emission Spectra Work
- [3] NASA Science — Types of Spectra and Spectroscopy
- [4] NASA Science — Beyond Temperature and Composition
- [5] European Space Agency — Gaia: Spectroscopy
- [6] NIST — Atomic Spectra Database
CURIOUS MINDS, SHARED IDEAS
Join the conversation
What surprised you? Share a thought or a question.
Loading reader responses…



