In this paper, we propose a new binary version of the flower pollination algorithm (BFPA) for solving 0–1 knapsack problem. The standard flower pollination algorithm (FPA) is used for the continuous optimization problems. So, a transformation function is used to convert the continuous values generated from FPA into binary ones. A penalty function is added to the evaluation function to give negative values for the infeasible solutions. The infeasible solutions are treated by using a two-stage repair operator called flower repair. Experimental results have proved the superiority of BFPA over other algorithms.