A wellhead to desander flange failed. In this paper, the causes of flange failure were systematically analyzed by chemical composition analysis, hardness test, scanning electron microscopy and energy spectrum analysis, XRD corrosion composition analysis and macroscopic morphology analysis. The results show that the hardness of the flange meets the standard requirements; the chemical composition meets the standard requirements; the main elements in the corrosion pit are C, O, Fe and a small amount of S elements. XRD experimental results show that the corrosion products in the corrosion pits are mainly FeCO 3 , no iron sulfide is found, and it can be judged that the CO 2 in the transport medium is the main cause of flange corrosion. The presence of a large amount of CO 2 in the transport medium was detected, thus providing further evidence of CO 2 corrosion. There is no H 2 S in the conveying medium, and the S element detected in the corrosion pit may be that the S element in the flange gradually precipitates to the surface of the corrosion pit during the corrosion process of the flange; Based on the macroscopic characteristics of the corrosion pits and the corrosion products, it can be inferred that the flanges were not tightly fitted with the wound gaskets during the installation process and that gaps existed, which led to the accumulation of moist CO 2 gas there and caused the corrosion of the flanges. The results of the study have a positive effect on eliminating similar defects as well as eliminating safety hazards.