The association of dietary magnesium intake with chronic constipation has not been well‐studied in general population. Therefore, the aim of this study was to examine whether increased intake of dietary magnesium is associated with the presence of chronic constipation. Data from the 2007–2010 National Health and Nutrition Examination Survey (NHANES) were used. A total of 9,519 participants (4,814 men and 4,705 women) aged ≥20 years were included. The individual's bowel habits (chronic constipation) were evaluated using the questionnaire on bowel health and two different definitions of constipation (stool consistency and stool frequency) were used. Dietary magnesium intake was obtained from 24‐h dietary recall. Participants were categorized based on the quartiles of magnesium intake. Multivariable logistic regressions models were performed controlling for confounding factors. After multivariable adjustment, dietary magnesium intake was inversely associated with chronic constipation defined by stool frequency, and the ORs (95% CIs) across quartiles 2–4 compared with the lowest quartile were 0.71 (0.51–0.99), 0.78 (0.46–1.31), and 0.39 (0.16–0.95), respectively. In addition, there was a significant trend for the decreased prevalence of chronic constipation by quartiles of magnesium intake only among men (p for trend < .001). However, no statistically significant association between magnesium intake and prevalence of chronic constipation defined by stool consistency was observed. More evidence from longitudinal studies is needed to confirm these findings.