Compared with single-mode laser, multimode fiber laser can achieve higher output power. But with distorted phase distribution, the beam quality of multimode laser is poor. To improve the beam quality of multimode laser, phase optimization of multimode laser based on the stochastic parallel gradient descent (SPGD) algorithm is presented in this paper. To realize the phase control of beam, a multiple pixels screen used as phase correction device is added in the output light path. In the SPGD algorithm, the pixels of phase correction screen are regarded as the controlled variables, power in the bucket (PIB) of the far field is used as the evaluation function. By changing the phase modulation of each pixel, the optimal PIB is obtained by this algorithm, and the beam quality is improved. The optimization of high-order mode beam and multimode beam are calculated respectively. The multimode beam includes two modes: TEM00 and TEM21 and the proportion of output power is 1:1. The results show that the PIB of the single high-order mode beam is improved from 0.02 to 0.70 after 30000 times iteration., the multimode laser is improved from 0.02 to 0.40 after 20000 times iteration. According to the result, parameters of the algorithm are adjusted to improve efficiency and practicability.