There are growing concerns about substantial socio-economic differences between districts, as well as gender achievement gaps in many developed nations. Yet, most previous studies have focused on a single ecological context, ignoring potential interactions between gender and district contexts. Moreover, prior estimates may be influenced by unmeasured differences between districts. In this study, we leverage within-district variation over six years within a multilevel framework to enhance our understanding of the contextual factors affecting student educational development. Our findings, derived from the nationally representative Seoul Educational Longitudinal Study linked to the Seoul Survey (2012 to 2017, N=2,373), indicate that boys benefit more from districts with higher levels of cultural satisfaction and social trustcompared to girls, beyond individual and school-level factors