Consensus-Based Optimization (CBO) is a stochastic, agent-based algorithm designed for solving global optimization problems, particularly in high-dimensional, non-convex settings with multiple local minima. This paper provides a comprehensive exploration of the CBO algorithm, focusing on its math- ematical foundation, practical implementation, and theoretical analysis. The dynamics of the algorithm are governed by interacting particles driven by a weighted mean and influenced by drift and noise terms, which balance exploration and exploitation. The mean field limit is derived to describe the behavior of the system as the number of particles grows, highlighting its connection to the Fokker-Planck equation. A special case of the Laplace principle is used to establish the algorithm’s ability to approximate the global minimizer. Numerical experiments demonstrate the effectiveness of the algorithm in challeng- ing test functions such as the Ackley function. This study emphasizes the scalability, robustness and applicability of the CBO method to problems where traditional gradient-based methods fail.