# Why add acid to rid of soluble carbonate or hydroxide impurities? Will it not also react with halide I'm testing for

When identifying metal halides with silver ions, the positive ion $\ce{Ag+}$ will form $\ce{AgX}$ with halide in a solution. However, $\ce{H+}$ is added (typically in the form of an acid like $\ce{HNO3}$) to solution to get rid of $\ce{OH-}$ and $\ce{CO3^{2-}}$ ions first. Will the $\ce{H+}$ not also react with the halide $\ce{X-}$?

Hydrogen halides are strong acids, meaning that their conjugate bases $\ce{X-}$ are extremely weak. Thus, adding $\ce{H+}$ will neutralize stronger bases such as $\ce{OH-}$ first before $\ce{X-}$.