In this research, by coupling a Navier-Stokes solver with the genetic algorithm, an automated design procedure is prepared to change the three-dimensional shape of the rotor and the stator blades of an axial flow compressor. The lean and sweep angles of the blades are considered to change the shapes of the rotor and stator blades. The structured computational grids are developed based on these files. Setting the appropriate boundary conditions and using the mixing plane, the computational domain is prepared. Then, the steady state and compressible mass and momentum conservation and turbulence equations are solved. In each case, the isentropic efficiency and mass flow rate of the modified compressors are computed. The objective function of optimization algorithm is calculated based on the compressor efficiency. After a specified iteration number, the optimum values of lean and sweep angles are achieved. The proposed method results in 1. 35% improvements in the compressor stage efficiency in design point while; the change in mass flow rate is 1% in comparison with the original compressor.