Flame test is a qualitative identification test that is used to detect the presence of metal ions in their salts either in their powder form or solutions. Flame test is not the sole test that is used for the identification of metals. However, it is a confirmatory test for some metals, especially group 1 metals.
In flame test, when atoms or ions are exposed to heating, electrons gain energy to be excited from their normal energy levels to higher energy levels. Afterward, the electrons jump back to their original energy levels; either in one in several steps, releasing energy as electromagnetic radiations. Each of these steps is represented by the emission of a specific amount of energy in the form of light that corresponds to a particular wavelength Hence, a spectrum of lights can be produced, some of which are within the visible region of the spectrum that will combine forming the light that we can see.
The space between different energy levels within an atom represents the transition sizes that would occur for the electrons, and consequently the energy and wavelengths of the electromagnetic radiation emitted.
Figure 1. Schematic Diagram showing different energy levels for electrons excitations