ObjectivesThe growing global burden of pain is gradually expanding from the medical field to public health. Dietary inflammatory potential correlates with inflammatory markers, and inflammation is one of the main mechanisms of pain.MethodsThis study explored the association between dietary inflammatory index (DII) and pain from the NHANES database on DII and pain (neck pain, low back pain, joint pain, and headache or migraine) using logistic regression and stratified analysis.ResultsThe results show a stronger association between DII and joint pain (Q4 of DII adjusted-OR = 1.23, 95% CI = 1.08-1.40, P = 0.003) and headache or migraine (Q4 of DII adjusted-OR = 1.31, 95% CI = 1.15-1.48, P < 0.001), but no association is found in neck pain (Q4 of DII adjusted-OR = 1.03, 95% CI = 0.89-1.20, P = 0.65) and low back pain (Q4 of DII adjusted-OR = 1.04, 95% CI = 0.92-1.17, P = 0.54). After stratifying the data according to demographics, differences in the relationship between DII and pain are found at different levels of the population.DiscussionThis study identifies high DII as a risk factor for joint pain and headache or migraine.