Different stars can be categorised into certain groups, depending on their mass and temperature. Over the centuries, the classification of stars has evolved into seven distinct classes or groups. This system was created by Annie Jump Cannon and the groups are known as O, B, A, F, G, K and M. Stars classified in the 'O' group are the most massive and hottest, with temperatures exceeding 30,000°C, whilst those in the 'M' group are the smallest and coolest, with temperatures less than 3,000°C.
Stars of different temperatures appear to shine with different colours. This is similar to what happens when you heat up a lump of metal to very high temperatures. After heating the metal for some time, it will start to glow red. As it gets hotter still, that red will evolve into yellow, then white and eventually the metal will be glowing a bright blue colour. In the same way, it turns out that blue stars are very hot and are therefore classed as 'O' stars, whereas the cooler, red stars, are placed into the 'M' class.
When we think about our star, the Sun, we picture it as being yellow. It is therefore not surprising to discover that the Sun is classed as a 'G' star, with a temperature of approximately 5,500°C. The following table lists the different classes of stars, along with their approximate temperatures and colours.
Stars can be more accurately categorised under this system, by the addition of a number between 0-9 to the group letter. For example, G2 (the Sun’s more precise spectral class) is hotter than G7, but cooler than a G0. Similarly, a B9 star is cooler than a B4.