Considering the intermediate principal stress effect of soils, the unified strength theory was applied to correct the shear strength index of soils. Based on a mechanical model of the anti-seismic stability of slopes, the analytical formula of the stability coefficient was deduced by the upper bound method and the quasi-static method. Then the optimal solution of the stability coefficient was figured out via the Matlab software. The result shows that, if the intermediate principal stress is ignored, the shear strength of soils would obviously be underestimated; this is also the case with the slope stability coefficient, the relative error of which could reach 39.87%. The horizontal and vertical seismic forces significantly affect slope stability. When the horizontal seismic force is considered, the slope stability coefficient Ns is reduced by 79.82%. Similarly, if the seismic effect is not neglected, the stability of the slope would be seriously overestimated. Slope cutting can significantly improve slope stability. When the slope angle is reduced from 90° to 50°, the stability factor increases by 279.82%. The suitable design angle of the slope is between 50° and 60° without taking into account additional elements like groundwater level and stratum structure.