Nessler's reagent is prepared by the reaction of mercuric chloride in the excess of KI. HgCl2+2KI⟶ scarlet ppt. HgI2+2KCl HgI2+2KI⟶potassium tetraiodo mercurate(II) colourless complexK2[HgI4]
Alkaline solution of K2[HgI4] is called Nessler's reagent. It is used to test NH3 or NH4+ions which give brown precipitate or colouration with ammonia due to the formation of the iodide of Millon's base Hg2NI⋅H2O. It has the structure