Testing for sulfate ions
Sulfate ions in solution, SO42-, are detected using barium chloride solution. The test solution is acidified using a few drops of dilute hydrochloric acid, and then a few drops of barium chloride solution are added. A white precipitate of barium sulfate forms if sulfate ions are present.
For example:
barium chloride + sodium sulfate → sodium chloride + barium sulfate
BaCl2(aq) + Na2SO4(aq) → 2NaCl(aq) + BaSO4(s)
The hydrochloric acid is added first to remove any carbonate ions that might be present - they would also produce a white precipitate, giving a false positive result.
Barium nitrate solution can be used instead of barium chloride solution. However, nitric acid is added first to acidify the test solution. Sulfuric acid cannot be used because it contains sulfate ions - these would interfere with the second part of the test.