A chemical role played by any unwanted chemical substance inside a confined amount of liquid, gas, or solid, which differs from the chemical composition of the material or compound. For example, an impurity can be an undesired by-product of a chemical reaction or manufacturing process, a drug contaminant, or can be created upon degradation during storage.