This study aims to evaluate the interaction effect of socio-economic environment (SEE) in the relationship between the eating location (EL) and diet quality, in children and adolescents. Data included Portuguese children and adolescents (3–17 years) from a National Dietary Survey Sample (IAN-AF 2015/2016, n 987). Dietary intake was obtained by 2-d food diaries (children) or 2–24-h-recall (adolescents). Participants were classified into four groups of EL: ‘Home’, ‘Other homes’, ‘School’ and ‘Restaurants’. Diet quality was measured as a higher adherence to a healthy eating pattern. A previous developed socio-economic classification was used, and participants were grouped as belonging to a low socio-economic environment (LSE) or middle-high socio-economic environment (MHSE). Linear regression models were used to evaluate the association between EL and diet quality, stratified by the SEE. A statistically significant interaction effect was found (P < 0·01) for the SEE in the association between EL and diet quality. After adjustment for potential confounders, in LSE, participants belonging to ‘Other homes’ (β = –2·07; 95 % CI:–3·70, –0·44) and ‘Restaurants’ (β = –3·31; 95 % CI: –5·08, –1·54) had lower scores in the diet quality score, comparing to ‘Home’. In MHSE, comparing with ‘Home’, ‘Restaurants’ showed lower diet quality (β = –1·56; 95 % CI:–2·65, –0·48), while the ‘School’ had better diet quality (β = 0·90; 95 % CI: 0·16, 1·64). The SEE influences the association between EL and diet quality and, belonging to more disadvantaged SEE, might represent a higher risk of unhealthy eating habits when eating out-of-home.