This cross-sectional study aimed to investigate the correlation between magnesium consumption and periodontitis in different body mass index (BMI) and waist circumference (WC) groups. 8385 adults who participated in the National Health and Nutrition Examination Survey during 2009–2014 were included. The correlation between dietary magnesium intake and periodontitis was first tested for statistical significance by descriptive statistics and weighted binary logistic regression. Subgroup analysis and interaction tests were performed to investigate whether the association was stable in different BMI and WC groups. There was a statistical difference in magnesium intake between periodontitis and non-periodontitis populations. In model 3, participants with the highest magnesium consumption had an odds ratio of 0.72 (0.57-0.92) for periodontitis compared to those with the lowest magnesium consumption. However, in subgroup analysis, the relationship between magnesium intake and periodontitis remained significant only in the non-general obese (BMI ≤ 30 kg/m2) and non-abdominal obese populations (WC ≤ 102 cm in men and ≤ 88 cm in women). Dietary magnesium intake might decrease the periodontitis prevalence in the American population, and this beneficial periodontal health role of magnesium consumption might only be evident in non-general obese and non-abdominal obese populations.