BACKGROUND: Gallstones have been linked to obesity. Relative fat mass (RFM) has emerged as a novel obesity index that more precisely represents the body fat distribution. The correlation between RFM and the risk of developing gallstones remains unclear. This study aims to explore the correlation between RFM and the prevalence of gallstones. METHODS: A cross-sectional analysis was conducted on the data from the NHANES 2017-2020. The correlation between RFM and the formation of gallstones was examined through multivariate logistic regression, receiver operating characteristic (ROC) curve, sensitivity analysis, subgroup analysis, and restricted cubic spline regression. RESULTS: Among the 12,947 subjects, 1362 were categorized as having gallstones. It was observed that as the quartile range of RFM increased, with a notable rise in the prevalence of gallstones (3.7% vs. 7.5% vs. 9.8% vs. 21.1%, P <
0.002). Logistic and RCS regression analyses indicated a significantly positive linear correlation between RFM and the prevalence of gallstones, even after accounting for confounders potential (adjusted OR = 1.075, 95% CI: 1.050, 1.101). There is still a significant correlation between RFM and the prevalence of gallstones across both subgroup and sensitivity analyses. ROC analysis indicated that RFM (AUC = 0.696, 95%CI: 0.682, 0.711) can serve as a more robust identify for developing gallstones compared to traditional anthropometric indices. CONCLUSION: This study is the first to provide the evidence of a significantly positive correlation between RFM and the formation of gallstones. However, further prospective studies are needed to validate these findings.