Anemia is a widespread global health concern, and recent research has unveiled a link between anemia and inflammation. The Dietary Inflammation Index (DII) is a novel tool used to assess the overall inflammatory potential of an individual's diet. However, until now, there have been no studies demonstrating a connection between DII and anemia. This study aimed to explore the relationship between DII and the risk of anemia among Americans, as well as to examine the influence of other risk factors on this association. Data from 32,244 patients were collected from the National Health and Nutrition Examination Survey (NHANES) database spanning from 1999 to 2018. Using multivariable logistic regression, we examined the correlation between DII and anemia. Subgroup analyses and smoothed curve analyses were conducted to further investigate the association between DII and anemia. The analysis revealed a significant positive association between higher DII scores and increased anemia risk in the American population (Odds Ratio [OR] = 1.06, 95% Confidence Interval [CI] = 1.03 to 1.09, p < 0.0001). This association remained consistent in subgroup analyses, encompassing various age groups, distinct Body Mass Index (BMI) categories, varying diabetes mellitus statuses, histories of hypertension, females, individuals with a RIP <3.5, and Non-Hispanic Black individuals. Notably, the association was particularly significant among non-smokers. Smoothed curve fitting analysis demonstrated a linear relationship between DII and the prevalence of anemia. Our findings underscore a positive correlation between the inflammatory potential of one's diet and the risk of anemia, especially when coupled with other risk factors. Consequently, reducing the consumption of pro-inflammatory foods may serve as one of the effective measures against the development of anemia. Given the variations in gender, age, BMI, and chronic diseases observed in our study, tailored policies could better cater to the specific needs of diverse populations.