A corrosion inhibitor is a chemical compound that, when added to a liquid or gas, decreases the corrosion rate of a material, typically a metal or an alloy, that comes into contact with the fluid.