This paper presents a binary variant of a novel physics-based meta-heuristic optimization algorithm, namely Light spectrum optimizer (LSO), for tackling both the 0–1 knapsack (KP01) and multidimensional knapsack problems (MKP). Because of the continuous nature of the standard LSO that contradicts the knapsack problem's discrete nature, two various transfer functions: S-shaped and X-shaped, are used to convert the continuous values produced by LSO into discrete ones. Some binary solutions produced by the binary LSO (BLSO) may be infeasible, so an improvement-repair strategy is used to convert those solutions into feasible ones by making some improvements on them. Moreover, the classical LSO was modified in this study to propose a new binary variant, namely BMLSO, with better exploration and exploitation operators for overcoming the knapsack problems. Additionally, a novel method, which simulates the swarm intelligence behaviors and the simulated binary crossover (SBX) to accelerate the convergence speed with avoiding stuck into local minima, has been proposed for producing a new binary variant of MLSO known as BHLSO. To verify the performance of the proposed binary variants of LSO, 45 benchmark instances of KP01 and 30 benchmark instances of MKP used commonly in the literature have been used in our experiments. The experimental findings show the superiority of BHLSO for both KP01 and MKP compared with several well-known algorithms in terms of CPU time, convergence speed, and accuracy.