The carob pod, an important fruit of the food industry in the production of concentrated syrup, is rich in potentially health-promoting phenolic compounds and sugars. Moreover, one of the important bioactive components of carob is D-pinitol, and it has some beneficial effects on human metabolism. The optimum conditions for extraction of D-pinitol and total phenolic compounds (TPC) from cultivated and wild types of carob pods were determined using response surface methodology (RSM). The Box-Behnken Design (BBD) was used to investigate the effects of three independent variables; extraction temperature (degrees C), dilution rate (w/v), and extraction time (h) on the response, D-pinitol and the total phenolic compounds. The optimum extraction conditions obtained using the response optimizer were an extraction temperature of 80 degrees C, a dilution rate of 1:4, and an extraction time of 2h. Under the mentioned above conditions, the maximum D-pinitol and TPC concentrations were 9.67 g/L and 5916.55 mg/L in wild carob pod extract, respectively.