PurposeThe purpose of this paper is to clarify the effect of compressive stress on cavitation-erosion corrosion behavior of 304 stainless steel.Design/methodology/approachCompressive stresses of 60 MPa and 120 MPa were applied to 304 stainless steel through a self-designed loading device, and cavitation erosion-corrosion tests were performed using an ultrasonically vibratory apparatus. Scanning electron microscope and X-ray diffraction were used to analyze the microstructure evolution, and corrosion behavior was studied by electrochemical analysis.FindingsThe cavitation weight loss of 304 stainless steel decreased with the compressive stress. After cavitation corroded for 8 h, the weight loss for the specimen with 120 MPa compressive stress was 5.11 mg/cm2, which was reduced by 56.7% from that of the specimen without loading stress (11.79 mg/cm2). The reason can be attributed to that compressive stress promoted the deformation-induced martensitic transformation during the cavitation process, which could not only provide a cushioning effect by absorbing cavitation impact energy but also improve the hardness of 304 stainless steel.Originality/valueCompressive stress was found to restrain the cavitation damage on 304 stainless steel, and the corresponding mechanism was proposed.