In this study, simultaneous chemical and phase equilibrium calculations were carried out by the method of direct Gibbs energy minimization to perform a thermodynamic analysis of transesterification reaction of soybean oil with both ethanol and methanol in order to improve the processes for producing biodiesel. The CONOPT solver was used to solve the problem as a nonlinear programming model in the GAMS® 23.2.1 software. In addition, the UNIFAC model was employed to describe the liquid phase non-idealities. A strategy of balance of radicals is proposed to satisfy the requirement of conservation of number of moles in the specific case of transesterification reaction, in order to take into account the degrees of freedom of reacting system without explicitly writing all individual reactions. The results showed that the use of optimization techniques associated with the GAMS software are useful and efficient tools to calculate the chemical and phase equilibrium by minimizing of the Gibbs energy, provided that different initial guesses are used. Furthermore, the computational times spent in the calculations were quite small.