Guangxi, China, is one of the world's largest karst regions where potential toxic elements tend to accumulate, resulting in high soil background values. This study explores the ecological risk, elemental baseline values, and sources of potential toxic elements in karst regions, expanding the research to include 21 common elements. The significance of this research lies in its implications for the management of potential toxic element pollution, the formulation of environmental quality standards, and soil remediation in karst areas. In this study, 12,547 topsoil samples (0–20 cm) were collected in the study area. Pollution assessment and ecological risk evaluation of eight potential toxic elements (Zn, Ni, Cu, Pb, Cd, Hg, Cr, and As) were conducted using the geo-accumulation index method and potential ecological risk index method. Multivariate statistical analysis was applied to analyze the total content of 21 common elements (Zn, Ni, Cu, Pb, P, Cd, Hg, Co, Mn, Cr, V, I, S, As, pH, Se, N, CaO, Corg, Mo, and F). Additionally, the potential sources of 21 soil elements were preliminarily quantitatively analyzed using the principal component analysis-absolute principal component scores-multiple linear regression receptor model. The results showed that (1) Zn, Ni, Cu, Pb, Cd, Cr, V, and As were enriched in the research area and Ca, Cd, Mn, Mo, Hg, As, and Cu might have been influenced by human activities; (2) Cr, Pb, As, and Zn were generally lightly polluted, with Hg having a moderate potential ecological risk level; and (3) Ni and Zn have contributions of 37.99% and 35.07% from geological sources, agricultural fertilization, and pesticides. Mo, V, Cr, Se, Hg, and As exhibit contributions ranging from 39.44 to 59.22% originating from geological backgrounds and human activities. Corg, S, N, and P show contributions of 45.39% to 80.33% from surface vegetation. F, Co, Mn, and Pb have contributions ranging from 31.63 to 47.93% from acidic rocks in the soil parent material, mining activities, and transportation. Cd and CaO derive 31.67% and 40.23%, respectively, from soil parent material and industrial sources. I has 31.94% from geological background and human activities, and 31.95% from soil parent material and atmospheric sources. Cu has 30.56% from geological sources. The study results can serve as a scientific basis for element research in karst areas domestically and internationally.