Silver tarnishes when it reacts with sulfur compounds present in the air, such as hydrogen sulfide (H2S). This reaction forms a black layer of silver sulfide (Ag2S) on the surface of the silver.