Cavities are common subsurface anomalies that have a significant impact on the bearing capacity of footings. While cavities behave three-dimensionally, in previous studies, the analysis of cavities has been limited to two-dimensional plane-strain analysis because of the time-consuming nature and complexity of three-dimensional modeling. However, this study demonstrates that the bearing capacity factor derived from three-dimensional modeling can be up to 10 times higher than that obtained from plane-strain analysis, highlighting the importance of considering three-dimensional effects. The present paper conducted three-dimensional simulations to investigate the impact of spherical cavity on the failure mechanisms and bearing capacity of footings under undrained conditions. An extensive parametric study was performed to investigate the influential parameters, including footing width to cavity dimension ratio (B/D), cover depth ratio (C/D), overburden factor (γD/Su), and void eccentricity ratio (S/D) for both circular or square footings. The results indicate that increasing the overburden factor and void eccentricity ratio leads to a decrease and increase in the bearing capacity of the footing, respectively. Furthermore, changes in other parameters can either increase or decrease the bearing capacity depending on the characteristics of the cavity (size and location) and footing (size and shape). General solutions for the bearing capacity factor are provided for different variations of the dimensionless parameters. This study also examined various failure mechanisms, including both cavity-independent and cavity-dependent failure mechanisms, associated with circular and square footings and influential parameters. These mechanisms are categorized into three zones for cavity-independent failures and four zones for cavity-dependent failures. The changes in the influential parameters including B/D, S/D, γD/Su, and C/D lead to changes in the type of failure mechanism and the size of the failure zones, while the foundation shape does not have a significant effect on the failure mechanism. Sinkholes and underground cavities annually contribute to infrastructure damage and financial losses. The 1981 incident in Winter Park, Florida, exemplifies the real-world consequences. Previous investigations have been limited to two-dimensional models due to the time-consuming nature and complexity of three-dimensional modeling, but the real-world nature of cavities in three dimensions requires a more comprehensive understanding. This study directly addresses this need by investigating the impact of three-dimensional cavities on the bearing capacity of circular and square building foundations, also known as footings. This study thoroughly investigated the factors influencing the results, encompassing cavity size, depth, soil weight, and off-center position. It extensively explored potential footing failures, providing detailed discussions. Our findings are presented as easy-to-understand maps and charts covering a broad range of potential scenarios. These visual tools can help engineers and researchers accurately estimate the stability of a building's foundation when a cavity is present underneath. In simpler terms, this research has created a handy tool for professionals to predict the potential danger posed by hidden cavities to buildings and infrastructure. This knowledge can then be applied to ensure safer building practices, potentially saving a significant amount of money and preventing accidents in the future. [ABSTRACT FROM AUTHOR]