The Quantum Numbers
The theory of quantum mechanics tells us that in an atom, the electrons are found in orbitals, and each orbital has a characteristic energy. Orbital means "small orbit".   We are interested in two properties of orbitals - their energies and their shapes. Their energies are important because we normally find atoms in their most stable states, which we call their ground states, in which electrons are at their lowest possible energies.

The Principal Quantum Number , n
The quantum number n is called the principle quantum number. You already know this as shell. The shell "K" has been given the value n = 1, the "L" shell has been given the value n = 2.
                                  n       1    2    3    4   ...
                            shell      K    L   M   N  ...

The principle quantum number serves to determine the size of the orbital, or how far the electron extends from the nucleus.  The higher the value of n the further from the nucleus we can expect to find it.  As n increases so does the energy required as well because the further out from the nucleus you go the more energy the electron must have to stay in orbit.  Bohr's work took into account only this first principle quantum number. His theory worked for hydrogen because hydrogen just happens to be the one element in which all orbitals having the same value of n also have the same energy.  Bohr's theory failed for atoms other than hydrogen, however, because orbitals with the same value of n can have different energies when the atom has more than one electron.

The Secondary Quantum Number, l
      The secondary quantum number, l, divides the shells up into smaller groups of subshells called orbitals.  The value of n determines the possible values for l. For any given shell the number of subshells can be found by l = n -1.   This means that for n = 1, the first shell, there is only l = 1-1 = 0 subshells. ie. the shell and subshell are identical. When n = 2 there are two sets of subshells;  l = 1 and l = 0.  A number could be used to identify the subshell however to avoid confusion between the numerical values of n and those of l the l values are given a letter code.

                                         value of       0    1   2   3    4 .....
                             letter designation     s    p   d    f    g .....

To designate a particular subshell we write the number of the shell itself followed by the subshell designator.
                   n    l   This illustrates the relationship between "n" and "l".
                   1    s               the first shell has one orbital type associated with it.
                   2    s p            the second shell has two orbital types associated with it.
                   3    s p d         etc
                   4    s p d f
                   5    s p d f g

The principle quantum number describes size and energy, but the second quantum number describes shape. The subshells in any given orbital differ slightly in energy, with the energy in the subshell increasing with increasing l.  This means that within a given shell, the s subshell is lowest in energy, p is the next lowest, followed by d, then f, and so on. For example:

                                           4s < 4p < 4d < 4f --->  increasing energy

The Magnetic Quantum Number, ml
The third quantum number, ml, is known as the magnetic quantum number. It splits the subshells into individual orbitals.  This orbital describes how an orbital is orientated in space relative to other orbitals.  i.e. It gives 3D information. The first "s" subshell has a magentic number of  "1". The "p" subshell has a magnetic number of "3".  A simple numeric progression gives us:

                                        s    p   d     f     <---name of subshell
                                        1   3    5    7    <--- number of orbitals in that subshell
                                        2   6    10  14  <--- number of electrons that will fit into that subshell.*

*An orbital can hold two electrons total. It may hold none, one or two but never more than two.

The Spin Magnetic Number, ms
The fourth and final quantum number is used to indicate the orientation of the two electrons in each orbital. The values for ms are +1/2 and -1/2.   An atom is the most stable when its electrons have the lowest possible energy. Electrons get the lowest possible energy when they occupy the lowest possible energy orbitals available. But what determines how the electrons "fill" the orbitals?  Two electrons can fill each orbital. How can two electrons both with a negative charge, and therefore mutually repulsive stay together in the same orbital?

The concept of electron spin is based on the fact that electrons behave like tiny magnets. An electron spins about it axis much like a toy top. The revolving electrical charge generates a magnetic field. (The same effect makes electric motors and generators work.)  The electron can spin in two directions, either clockwise or counter-clockwise.  Using the Left Hand rule for magnetic fields the clockwise spinning electrons generate a north pole on top and a south pole on the bottom. The counter-clockwise spinning electrons generate a north pole on the bottom and a south pole on the top.

In 1925 an Autrian physicist, Wolfgang Pauli (1900-1958), expressed the importance of electron spin in determining electronic configurations. The Pauli exclusion principle states that no two electrons in the same atom may have identical values for all four quantum numbers.  This means that the two electrons that fill any particular orbital must have opposite spins.  What happens if an orbital contains only 1 electron?  Then its magnetic field is not cancelled out and it can be attracted to other outside magnetic fields.  Atoms having at least one an unpaired electron are paramagnetic and can be attracted to magnetic fields.  Atoms with no unpaired electrons are said to be diamagnetic and are not seen to be magnetic.

In general, the number of electrons in a shell is 2n2.

    shell       number of subshells    maximum number of electrons
      1                  1s                                         2
      2                  2s 2p                                    8
      3                  3s 3p 3d                             18
      4                  4s 4p 4d 4f                         32