In this paper, superhydrophobic ceramic coatings were successfully prepared on stainless steel substrates (S304) by sol-gel method, and the effects of pore content and pH conditions on the corrosion resistance of hydrophobic ceramic coatings were studied. As the porosity increases, the contact angle of the coating increases. Among them, the contact angles of the coatings with 15% and 20% porosity in different pH solutions are all greater than 150 • , achieving superhydrophobic surfaces. The contact angle results before and after corrosion show that the solution with a higher pH has a greater damage to the hydrophobicity of the coating. The corrosion resistance of the coatings was evaluated comparatively from polarization curves and electrochemical impedance spectroscopy. As the hydrophobicity improves, the corrosion resistance of the hydrophobic ceramic coating is enhanced. The impedance moduli at .01 Hz of the coating are 1.04 × 10 3 times (pH 4), .13 × 10 3 times (pH 7), and .74 × 10 3 times (pH 10) of the bare steel, respectively. With the increase of pH, the corrosion resistance of hydrophobic ceramic coatings decreases, because OH − in the corrosion solution is more easily adsorbed on the surface of the coating, thereby destroying the long hydrophobic chains.