The presence of underground cavities can adversely influence the bearing capacity of soil under a footing. Due to the complexities involved in analyzing irregular cavities, researchers often adopt a simplification approach by approximating these irregular cavities with regular cavities. Consequently, the investigation of two- and three-dimensional irregular cavities has been limited. While it is reasonable to conduct a three-dimensional model to accurately simulate the actual mechanical response of cavities, this study explores the influence of underground irregular cavities on the bearing capacity of soil beneath square footings. Traditionally, due to the intricacies of analyzing irregular cavities, researchers have preferred to use regular-shaped approximations, primarily spherical. However, this study suggests that such simplifications can lead to bearing capacity estimates that are up to 40% higher in certain scenarios, posing significant safety risks. Consequently, there is an emergent need for accurate three-dimensional modeling to genuinely replicate cavity mechanical responses. This paper introduces a novel shape generation technique grounded in the inverse discrete Fourier transform (IDFT) and employs a self-developed algorithm to ensure optimal mesh distribution. The present paper spans seven unique cavity shapes, embodying various features like elongation and varied irregularities. Key parameters, including footing width ratio, cavity depth ratio, internal friction angle, irregularity intensity, and void eccentricity, are scrutinized for their effects on bearing capacity and associated failure mechanisms. Results suggest that heightened shape irregularities typically decrease bearing capacity, but this reduction can be substantially counteracted by increasing the internal friction angle. Cohesive soils predominantly exhibit cavity-induced bearing capacity alterations, with cavity stability playing a pivotal role in the eventual failure. Crucially, this research pinpoints conditions where approximating the true cavity shape with a spherical representation is acceptable.