While there is a large body of literature on the negative health effects of air pollution, there is much less written about its effects on cognitive performance for the whole population. This paper studies the effects of contemporaneous and cumulative exposure to air pollution on cognitive performance based on a nationally representative survey in China. By merging a longitudinal sample at the individual level with local air-quality data according to the exact dates and counties of interviews, we find that contemporaneous and cumulative exposure to air pollution impedes both verbal and math scores of survey subjects. Interestingly, the negative effect is stronger for men than for women. Specifically, the gender difference is more salient among the old and less educated in both verbal and math tests.