Abstract Corrosion behavior of metals in 1-ethyl-3-methylimidazolium–dicyanamide, butylmethylpyrrolidinium–dicyanamide, and 1-ethyl-3-methylimidazolium chloride–chloroaluminate ionic liquids (ILs) is studied. The constituent anions, rather than the cations, are the predominant species that govern the IL corrosivity toward materials. Among the materials investigated, Ni shows the lowest corrosion current and the best resistance against anodic dissolution in the three ILs. In the dicyanamide-based ILs, 304 stainless steel, Ti, and Al also exhibit satisfactory anti-corrosion characteristics. However, the use of Cu, carbon steel, and Mg in the same environment should be avoided due to their poor corrosion resistance, especially under anodic polarization conditions.