The paper make optimal design of NW planetary gear reducer. While all the design factor has been considered, the optimal mathematical model and constraint conditions of each independent variable is determined. On the basis of simplifying model, the MATLAB is used to develop the algorithm program. Then the program is carried out. Finally, the operational results are revised and checked. The operational results show that this method can ensure the design quality. At the same time, the method also can enhance the efficiency of programming.