Many people are interested in cookies. Due to the high consumer interest in cookies, many companies produce cookies with various variants, one of which is Rizky Bakery. The problem faced by Rizky Bakery is how to determine the amount of production of 6 types of cookies to reach the maximum profit. Rizky Bakery carries out production activities to meet high market demand and standard demand. This study constructs a model that accommodates both conditions. The model is solved by using the Branch and Bound method constraints on materials, manufacturing time, fee labor, payment for resellers, and production targets. The purpose of this research is to determine the total number program model and the optimal solution by maximizing the profit of cookie production using Branch and Bound. Optimization using the Branch and Bound method can utilize the Python programming language with a limit of 50 iterations. Data collection methods used for this research are interviews and documentation. The limitation of the problem in this research is that the model to be studied is limited to the average condition of demand is standard and when demand is high. The results of the analysis at times of high demand showed that the production of nastar cookies, castangel cookies, mawar cookies, putri salju cookies, peanut cookies, and custard cookies in 300-gram packaging respectively are 250, 45, 80, 39, 90, 150 and in 500-gram packages are 40, 10, 10, 6, 45, and 45. While, the result of standard demand in 300-gram packaging respectively are 100, 25, 50, 16, 50, 60 and the 500-gram packaging respectively are 10, 3, 10, 2, 10, 20. The profit earned when the demand is high is IDR 8,769,412.00 and the standard demand is IDR 3,769,504.00.