Stainless steel 17-4PH is a type of hardening precipitation stainless steel that has a good combination of excellent mechanical properties and good corrosion resistance. The heat treatment used to strengthen the alloy 17-4PH is an aging process that results in the formation of precipitates in the matrix of the alloy. The purpose of this study was to compare the S-N curves of 17-4PH alloy under two thermal cycles, H1150 as an over-aged thermal cycle and thermal optimization cycle as an aging cycle in fatigue and corrosion fatigue tests. After performing heat treatment and microstructural studies, hardness, tensile strength, charpy impact, corrosion, fatigue and corrosion fatigue tests were performed on samples. To increase the effect of corrosive environment, corrosion fatigue test was performed at a frequency of 0.42 Hz. Microstructural analysis and X-ray diffraction (XRD) test showed that one of the main microstructural differences in the alloy of 17-4PH between aged and over-aged thermal cycles was the presence of a significant amount of the austenite returned in the over-aged sample (at least more than 15 %). Another microstructural difference is the formation of a much smaller copper precipitate in the 17-4PH alloy in the OHC thermal cycle compared to the H1150 thermal cycle. Hardness, stretching and charpy impact tests showed that the alloy of 17-4PH in the aged thermal cycle had more Strength and hardness than the over-aged thermal cycle. On the other hand, the alloy in the H1150 thermal cycle has more flexibility than the optimal thermal cycle. Corrosion tests showed that, although an alloy of 17-4PH in the optimal heat cycle has a better general corrosion behavior (less corrosion current and higher corrosion potential) than the alloy in the H1150 thermal cycle, it also has more functionality to form stable pits in the optimal thermal cycle. The fatigue limit of the alloy of 17-4PH in an aged thermal cycle was 700 MPa and in a corrosive 3.5% NaCl solution was similar to the corrosive environment of the sea water, 415 MPa was obtained, which showed a reduction of more than 40 % in fatigue limit, for the presence of corrosive environment. The fatigue limit of the 17-4PH alloy was obtained 600 MPa in air in over-aged thermal cycle and 445 MPa in a corrosive 3.5 % NaCl solution, which showed a reduction of more than 25 % in fatigue limit, for the corrosive environment. The reason for a further decrease in the fatigue limit of the 17-4PH alloy in the aged thermal cycle compared to the over-aged thermal cycle is the ability of the formation of stable pits in the aging sample and more flexibility of the over-aging sample.