AbstractObjectives:To evaluate the association between diet quality and cost for foods purchased for consumption at home and away from home.Design:Cross-sectional analysis. Multivariable linear regression models evaluated the association between diet quality and cost for all food, food at home (FAH) and food away from home (FAFH).Setting:Daily food intake data from the National Health and Nutrition Examination Survey (2005–2016). Food prices were derived using data from multiple, publicly available databases. Diet quality was assessed using the Healthy Eating Index-2015 and the Alternative Healthy Eating Index-2010.Participants:30 564 individuals ≥20 years with complete and reliable dietary data.Results:Mean per capita daily diet cost was $14·19 (95 % CI (13·91, 14·48)), including $6·92 (95 % CI (6·73, 7·10)) for FAH and $7·28 (95 % CI (7·05, 7·50)) for FAFH. Diet quality was higher for FAH compared to FAFH (P < 0·001). Higher diet quality was associated with higher food costs overall, FAH and FAFH (P < 0·001 for all comparisons).Conclusions:These findings demonstrate that higher diet quality is associated with higher costs for all food, FAH and FAFH. This research provides policymakers, public health professionals and clinicians with information needed to support healthy eating habits. These findings are particularly relevant to contemporary health and economic concerns that have worsened because of the COVID-19 pandemic.