An optimal control scheme for biodiesel transesterification processes is proposed. The performance criterion of the optimal control problem is the concentration profits gained from biodiesel in a given time, which is subject to the nonlinear differential equations and boundary constraints of control variables. An optimal control model of biodiesel is presented. The adjoint equations of the optimal control problem and the gradient of the objective function are derived by using the maximum value principle. A gradient based numerical method is given for solving the optimal control problem and the simulation results illustrate the feasibility and the effectiveness of the proposed method.