The halogens are the elements in Group 7 of the periodic table. Chlorine, bromine and iodine are halogens. Their ions are called halide ions, eg chloride, Cl-.
Halide ions in solutions are detected using silver nitrate solutions. The test solution is acidified using a few drops of dilute nitric acid, and then a few drops of silver nitrate solution are added. Different coloured silver halide precipitates form, depending on the halide ions present.
silver nitrate + sodium bromide → sodium nitrate + silver bromide
AgNO3(aq) + NaBr(aq) → NaNO3(aq) + AgBr(s)
One way to remember the colours is to think of ‘milk, cream, butter’ (white, cream, yellow).
The nitric acid is added first to remove any carbonate ions that might be present - they would produce a white precipitate of silver carbonate, giving a false-positive result for chloride ions.