In this paper, a heuristic algorithm has been presented with the aim of determining the quantity of the best batch size for minimizing the makespan of a production system in order to meet the demands of a specified period for a product. This algorithm calculates the time required for fulfilling each of the requisite operations for producing a batch size by taking into account the standard time for fulfilling the operations, the number of similar parts used in one unit of a product, the machinery setup time, the scrap proportion of each operation on the relevant machinery and the quantity of that batch size. This algorithm allots the requisite operations to the machinery for producing the total demand of a specified period by making use of the calculated information, shortest processing time (SPT) rule, the specified conditions in the algorithm and the quantity of the production in each batch size. Then, with respect to the quantity of this batch size, the aggregate of the setup and idle times of machinery is calculated for the whole period. Afterwards, the quantity of the optimum batch size, which minimizes the aggregate of these times, is obtained by calculating the aggregate of these times for the different quantities of the batch sizes and comparing them. Some examples have been presented to compare this algorithm with the algorithms of Ho and Chang, Johnson, and Palmer. Key words: Flow-shop, batch size, makespan, setup time, idle time.