Given accumulating evidence that highlights the negative effect of the COVID-19 pandemic on public mental health, we examine green space accessibility as a potential mitigator. Based on mobility data from 2 million mobile phone users within London between January 2019 and December 2020, we found that, after the COVID-19 outbreak and during lockdowns, residential neighbourhoods within 800 m of the nearest green space had a higher proportion of green-space travellers (0.9–1.4 percentage points) compared with other neighbourhoods. Next, using multiwave data with a matched sample of 4,998 individuals across towns and cities in the United Kingdom, we demonstrate that individuals who lived close to green spaces experienced much less mental distress than those who lived farther away during lockdown periods. We imply that enhancing green space accessibility for residential neighbourhoods can help citizens become more resilient to future pandemics with mobility restrictions. Lee et al. combined data from mobile phone users, green spaces distribution and the United Kingdom Household Longitudinal Survey from 2020 to 2021 to evaluate how access to green spaces affected people’s mental health during COVID-19 pandemic lockdowns.