Three products are synthesized by adjusting current density and quantity of ionic liquid [Bmim][PF6] in electrochemical oxidation of piperazine. The molecular structures of N-methoxyl piperazine, Ncarbonyl piperazine and N, N'-dicarbonyl piperazine are determined by infrared spectroscopy and gas chromatography (GC)/mass spectrometry (MS). For application, the inhibition effect of the three products on the corrosion of HP13Cr steel in 20% (weight %) HCl solution was studied by means of weight loss and polarization measurements. The experiments revealed that N-carbonyl piperazine and N, N'-dicarbonyl piperazine show 91.0% and 95.2% inhibition efficiencies respectively at the concentration of 3% (weight %). However, the product of N-methoxyl piperazine has no inhibition behavior.