In astronomy, stellar classification is the classification of stars based on their spectral characteristics. Light from the star is analyzed by splitting it with a prism or diffraction grating into a spectrum exhibiting the rainbow of colours interspersed with absorption lines. Each line indicates an ion of a certain chemical element, with the line strength indicating the abundance of that ion. The relative abundance of the different ions varies with the temperature of the photosphere. The spectral class of a star is a short code summarising the ionization state, giving an objective measure of the photosphere's temperature and density.
Most stars are currently classified under the Morgan–Keenan system using the letters O, B, A, F, G, K, and M, a sequence from hottest to coolest. Useful mnemonics for remembering the spectral type letters are "Oh, Be A Fine Guy/Girl, Kiss Me" or "Oh Boy, An F Grade Kills Me". To also include the colder spectral classes L, T and Y, the first mnemonic can be extended to "Oh, Be A Fine Guy/Girl, Kiss Me Later Today, Yolo". Each letter class is then subdivided using a numeric digit with 0 being hottest and 9 being coolest.