Objectives The mechanism by which the home food environment (HFE) influences childhood obesity is unclear. The present study aimed to investigate the relationship between HFE and childhood obesity as mediated by diet in primary-school children. Design Cross-sectional data collected from parents and primary-school children participating in the Obesity Prevention and Lifestyle Evaluation Project. Only children aged 9-11 years participated in the study. Matched parent/child data (n 3323) were analysed. Exploratory factor analysis underlined components of twenty-one HFE items; these were linked to child diet (meeting guidelines for fruit, vegetable and non-core food intakes) and measured child BMI, in structural equation modelling, adjusting for confounders. Setting Twenty geographically bounded metropolitan and regional South Australian communities. Subjects School children and their parents from primary schools in selected communities. Results In the initial exploratory factor analysis, nineteen items remaining extracted eight factors with eigenvalues >1·0 (72·4 % of total variance). A five-factor structure incorporating ten items described HFE. After adjusting for age, gender, socio-economic status and physical activity all associations in the model were significant (P<0·05), explaining 9·3 % and 4·5 % of the variance in child diet and BMI, respectively. A more positive HFE was directly and indirectly associated with a lower BMI in children through child diet. Conclusions The robust statistical methodology used in the present study provides support for a model of direct and indirect dynamics between the HFE and childhood obesity. The model can be tested in future longitudinal and intervention studies to identify the most effective components of the HFE to target in childhood obesity prevention efforts.