What’s the Chemistry?

The heat of the flame causes electrons in the metal atom to rise up to higher energy levels. This "excited state" is not stable so the electron falls back to its original energy level ("ground state"). As it falls, it releases the energy as LIGHT.

Why do different metals cause different flame colours?

Different metal atoms have different separations between their ground and excited states ("energy gap"). This means that they emit different amounts of energy when electrons fall from the excited state to the ground state.

If you look at the spectrum of visible light below, you can see that different colours correspond to different energies (i.e. red light is at the 700 nm end of the spectrum and blue is at the 400 nm end).

nm= nanometre (one thousandth of a millionth of a metre (10-9))

If a metal atom has a small energy gap, low energy visible light (e.g. red light) will be emitted as excited electrons fall back to their ground state.

If a metal atom has a large energy gap, high energy visible light (e.g. blue light) will be emitted as excited electrons fall back to their ground state.