text: The halogens can all react with metals to form metal halides according to the following equation: 
  :2M + nX → 2MX
  where M is the metal, X is the halogen, and MX is the metal halide.
  In practice, this type of reaction may be very exothermic, hence impractical as a preparative technique. Additionally, many transition metals can adopt multiple oxidation states, which complicates matters. As the halogens are strong oxidizers, direct combination of the elements usually leads to a highly oxidized metal halide. For example, ferric chloride can be prepared thus, but ferrous chloride cannot. Heating the higher halides may produce the lower halides; this occurs by thermal decomposition or by disproportionation. For example, gold(III) chloride to gold(I) chloride:
  :AuCl → AuCl + Cl at 160°C
  Metal halides are also prepared by the neutralization of a metal oxide, hydroxide, or carbonate with the appropriate halogen acid. For example, with sodium hydroxide:
  :NaOH + HCl → NaCl + HO
  Water can sometimes be removed by heat, vacuum, or the presence of anhydrous hydrohalic acid. Anhydrous metal chlorides suitable for preparing other coordination compounds may be dehydrated by treatment with thionyl chloride:
  :MCl·xHO + x SOCl → MCl + x SO + 2x HCl
  The silver and thallium(I) cations have a great affinity for halide anions in solution, and the metal halide quantitatively precipitates from aqueous solution. This reaction is so reliable that silver nitrate is used to test for the presence and quantity of halide anions. The reaction of silver cations with bromide anions:
  :Ag (aq) + Br (aq) → AgBr (s)
  Some metal halides may be prepared by reacting oxides with halogens in the presence of carbon (carbothermal reduction):