Background: The association between body mass index (BMI) and kidney stone formation may vary across different age groups and follow nonlinear patterns.Methods: This study analyzed data from NHANES 2009–2018, including 14,880 participants aged ≥20 years, to evaluate the association between BMI and the risk of kidney stones. BMI was categorized as normal weight (<25.0 kg/m2), overweight (25.0–29.9 kg/m2), and obesity (≥30.0 kg/m2). Weighted logistic regression models were employed to adjust for multiple confounders, including sex, age, race/ethnicity, education level, smoking history, alcohol consumption, coronary heart disease, diabetes mellitus, hypertension, and physical activity. Interaction effects between BMI and key variables such as sex, race/ethnicity and other factors were also analyzed. Age-stratified analyses were performed for the groups aged 20–39 years, 40–59 years, and ≥ 60 years. A restricted cubic spline model was used to explore the non-linear relationship between BMI and the risk of kidney stones.Results: After adjusting for confounders, participants with a BMI ≥30 kg/m2 had a significantly higher risk of kidney stones compared to those with a BMI <25 kg/m2 (adjusted OR [aOR]: 1.86; 95% CI: 1.48–2.34; p < 0.001), with the association being most pronounced in the 40–59-year age group (aOR: 2.02; 95% CI: 1.36–3.02; p < 0.001). The interaction analysis did not reveal significant interactions between BMI and sex or other factors. Non-linear analysis indicated that the relationship between BMI and kidney stone risk differed across age groups. In the 40–59-year group, the risk of kidney stones peaked and then plateaued as BMI increased beyond a certain threshold. In the ≥60-year age group, risk initially increased with BMI but then slightly declined. This non-linear relationship suggests that the impact of BMI on kidney stone risk varies by age and should be considered in clinical strategies.Conclusion: High BMI is significantly associated with an increased risk of kidney stones, particularly among middle-aged and older adults. The relationship between BMI and kidney stones is non-linear, highlighting the need to develop age-specific BMI management strategies to reduce the occurrence of kidney stones.