Stellar classification according to scale. Source via CC-by-SA-3.0.
The mass, radius, and luminosity listed for each class are appropriate only for stars on the main sequence portion of their lives and so are not appropriate for red giants.
The reason for the odd arrangement of letters is historical. When people first started taking spectra of stars, they noticed that stars had very different hydrogen spectral lines strengths, and so they classified stars based on the strength of the hydrogen Balmer series lines from A (strongest) to Q (weakest). Other lines of neutral and ionized species then came into play (H and K lines of calcium, sodium D lines, etc). Later it was found that some of the classes were actually duplicates and those classes were removed. It was only much later that it was discovered that the strength of the hydrogen line was connected with the surface temperature of the star.
Spectral classes are further subdivided by Arabic numerals (0–9). For example, A0 denotes the hottest stars in the A class and A9 denotes the coolest ones. Because the classification sequence predates our understanding that it is a temperature sequence, the precise values of these digits depend upon (largely subjective) estimates of the strengths of absorption features in stellar spectra. As a result, the subclasses are not evenly divided into any sort of mathematically representable intervals. The Sun is classified as G2.
Class O stars are very hot and very luminous, being bluish in color; in fact, most of their output is in the ultraviolet range. These are the rarest of all main sequence stars, constituting as few as 1 in 3,000,000 in the solar neighborhood (Note: these proportions are fractions of stars brighter than absolute magnitude 16; lowering this limit will render earlier types even rarer while generally adding only to the M class). O-stars shine with a power over a million times our Sun’s output. These stars have dominant lines of absorption and sometimes emission for He II lines, prominent ionized (Si IV, O III, N III, and C III) and neutral helium lines, strengthening from O5 to O9, and prominent hydrogen Balmer lines, although not as strong as in later types. Because they are so huge, class O stars burn through their hydrogen fuel very quickly, and are the first stars to leave the main sequence. Recent observations by the Spitzer Space Telescope indicate that planetary formation does not occur around other stars in the vicinity of an O class star due to the photoevaporation effect.
Class B stars are extremely luminous and blue. Their spectra have neutral helium, which are most prominent at the B2 subclass, and moderate hydrogen lines. Ionized metal lines include Mg II and Si II. As O and B stars are so powerful, they only live for a very short time, and thus they do not stray far from the area in which they were formed. These stars tend to cluster together in what are called OB associations, which are associated with giant molecular clouds. The Orion OB1 association occupies a large portion of a spiral arm of our galaxy and contains many of the brighter stars of the constellation Orion. They constitute about 1 in 800 main sequence stars in the solar neighborhood — rare, but much more common than those of class O.
Class A stars are amongst the more common naked eye stars, and are white or bluish-white. They have strong hydrogen lines, at a maximum by A0, and also lines of ionized metals (Fe II, Mg II, Si II) at a maximum at A5. The presence of Ca II lines is notably strengthening by this point. They comprise about 1 in 160 of the main sequence stars in the solar neighborhood.
Class F stars have strengthening H and K lines of Ca II. Neutral metals (Fe I, Cr I) beginning to gain on ionized metal lines by late F. Their spectra is characterized by the weaker hydrogen lines and ionized metals. Their color is white with a slight tinge of yellow. These represent about 1 in 32 of the main sequence stars in the solar neighborhood.
Class G stars are probably the best known, if only for the reason that our Sun is of this class. Most notable are the H and K lines of Ca II, which are most prominent at G2. They have even weaker hydrogen lines than F, but along with the ionized metals, they have neutral metals. There is a prominent spike in the G band of CH molecules. G is host to the “Yellow Evolutionary Void”. Supergiant stars often swing between O or B (blue) and K or M (red). While they do this, they do not stay for long in the G classification as this is an extremely unstable place for a supergiant to be. G stars represent about 1 in 13 of the main sequence stars in the solar neighborhood.
Class K are orangish stars which are slightly cooler than our Sun. Some K stars are giants and supergiants, such as Arcturus, while others, like Alpha Centauri B, are main sequence stars. They have extremely weak hydrogen lines, if they are present at all, and mostly neutral metals (Mn I, Fe I, Si I). By late K, molecular bands of titanium oxide become present. These make up 1 in 8 of the main sequence stars in the solar neighborhood.
Class M is by far the most common class. At least 80% of the main sequence stars in the solar neighborhood are red dwarfs (see the note under Class O), such as Proxima Centauri. M is also host to most giants and some supergiants such as Antares and Betelgeuse, as well as Mira variables. The late-M group holds hotter brown dwarfs that are above the L spectrum. This is usually in the range of M6.5 to M9.5. The spectrum of an M star shows lines belonging to molecules and all neutral metals but hydrogen lines are usually absent. Titanium oxide can be strong in M stars, usually dominating by about M5. Vanadium oxide bands become present by late M.