Essential trace elements are vital for human growth and development. Nevertheless, excessive intake can pose risks. As of yet, no research has looked at the possibility of a relationship between the prevalence of gallstones and urinary concentrations of nickel, molybdenum, and iodine. The purpose of this study was to examine the correlation between urinary levels of iodine, molybdenum, and nickel and the occurrence of gallstones in a U.S. population and to verify whether excessive iodine intake is associated with the occurrence of gallstones. Data from 2,734 participants that were gathered between 2017 and 2020 were examined. Employing inductively coupled plasma mass spectrometry (ICP-MS), the levels of nickel (Ni), iodine (I), and molybdenum (Mo) in the urine were determined. Gallstones presence was determined using a standardized questionnaire. Restricted cubic spline analysis, subgroup analysis, and logistic regression analysis were used to evaluate the relationship between the occurrence of gallstones and urinary essential trace elements. The logistic regression analysis indicated an increased risk of gallstone development in Quartiles 2, Quartiles 3, and Quartiles 4 groups in comparison to the Quartiles 1 group, based on urinary iodine levels (OR = 1.69, 95% CI: 1.11-2.56; OR = 1.68, 95% CI: 1.10-2.55; OR = 1.65, 95% CI: 1.09-2.51). Urinary iodine levels were nonlinearly positively linked with the development of gallstones, according to restricted cubic spline analysis (P-Nonlinear = 0.032). Subgroup analyses showed that high levels of urinary iodine were associated with a high risk of gallstones in different populations, and were more pronounced in adults aged 60 years and older, in women, with a BMI ≥ 25, and in diabetic patients. Our research revealed a correlation between an increased risk of gallstones and increasing urinary iodine levels. Urinary iodine levels serve as indicators of the body's iodine status, thus suggesting that excessive iodine intake may be linked to an elevated risk of gallstone formation.