Vegetable oils and fats in comparison with diesel fuel have high viscosity, by transesterification method the viscosity of oil can be decreased. Transesterification of triglyceride with alcohol is one of the methods for production of biodiesel. In this study sunflower oil, methanol and ethanol, with molar ratio of (1:3, 1:4, 1:6, 1:8) and temperature (40, 50, 60 º C) were dependent parameters employing potassium hydroxide as a catalyst at the concentration of 1%. The reaction was carried out for 90 min at 600 rpm. The product viscosity was measured at 40ºC. Gas chromatogram showed that the highest yield of methyl and ethyl ester of sun flower oil at 1: 8 molar ratio of oil to alcohol at 60 º C could be obtained. The conversion rates were 96% and 85% for methyl ester and ethyl ester respectively. It was found that temperature and the ratio of oil to alcohol are two important factors in biodiesel production and thus increasing biodiesel yields. The result suggested that molar ratio of methanol to oil (1:8) at 60 º C for biodiesel production is optimal.