This study presents a novel physics-based metaheuristic algorithm called Kepler optimization algorithm (KOA), inspired by Kepler’s laws of planetary motion to predict the position and velocity of planets at any given time. In KOA, each planet with its position acts as a candidate solution, which is randomly updated through the optimization process with respect to the best-so-far solution (Sun). KOA allows for a more effective exploration and exploitation of the search space because the candidate solutions (planets) exhibit different situations from the Sun at different times. Four challengeable benchmarks, namely CEC 2014, CEC 2017, CEC 2020, and CEC2022, and eight constrained engineering design problems, in addition to the parameter estimation problem of photovoltaic modules, were used to assess the performance of KOA. To observe its effectiveness, it was compared with three classes of stochastic optimization algorithms, including: (i) the latest published algorithms, including Snake Optimizer (SO), Fick’s Law Algorithm (FLA), Coati Optimization Algorithm (COA), Pelican Optimization Algorithm (POA), Dandelion Optimizer (DO), Mountain Gazelle Optimizer (MGO), Artificial Gorilla Troops Optimizer (GTO), and Slime Mold Algorithm (SMA); (ii) well-studied and highly cited algorithms, such as Whale Optimization Algorithm (WOA) and Grey Wolf Optimizer (GWO); and (iii) two highly performing optimizers: LSHADE-cnEpSin and LSHADE-SPACMA. Results of the convergence curve and statistical information indicated that KOA is more promising than all the compared optimizers. The source code of KOA is publicly accessible at https://www.mathworks.com/matlabcentral/fileexchange/126175-kepler-optimization-algorithm-koa