BackgroundPoor sperm quality is a major cause of male infertility. However, evidence remains scarce on how greenness affects male sperm quality. ObjectivesTo assess the associations of residential greenness with male sperm quality and the modification effect of air pollution exposure on the relationship. MethodsA total of 78,742 samples from 33,184 sperm donors from 6 regions across China during 2014–2020 were included and analyzed. Individual residential greenness exposures of study subjects were estimated using the Normalized Difference Vegetation Index (NDVI) during the entire (0–90 lag days) and two key stages (0–37, and 34–77 lag days) of sperm development. Contemporaneous personal exposure levels to air pollutants were estimated using a spatio-temporal deep learning method. Linear mixed models were employed to assess the impact of greenspace in relation to sperm quality. The modification effect of air pollution on the greenspace-sperm quality relationship was also estimated. ResultsPer IQR increment in NDVI exposure throughout spermatogenesis were statistically associated with increasing sperm count by 0.0122 (95 % CI: 0.0007, 0.0237), progressive motility by 0.0162 (95 % CI: 0.0045, 0.0280), and total motility by 0.0147 (95 % CI: 0.0014, 0.0281), respectively. Similar results were observed when the model added air pollutants (PM1, PM2.5 or O3) for adjustment. Additionally, specific air pollutants, including PM1, PM2.5, and O3, were found to modify this association. Notably, the protective effects of greenness exposure were more pronounced at higher concentrations of PM1 and PM2.5 and lower concentrations of O3 (all Pinteraction < 0.05). Statistically significant positive effects of NDVI were observed on sperm motility in early spermatogenesis and sperm count in late spermatogenesis. ConclusionsExposure to residential greenness may have beneficial effects on sperm quality and air pollution modifies their relationship. These findings highlight the importance of adopting adaptable urban greenspace planning and policies to safeguard male fertility against environmental factors.