More than half of the world's population now lives in cities, making the creation of a healthy urban environment a major policy priority. Cities have both health risks and benefits, but mental health is negatively affected: mood and anxiety disorders are more prevalent in city dwellers and the incidence of schizophrenia is strongly increased in people born and raised in cities. Although these findings have been widely attributed to the urban social environment, the neural processes that could mediate such associations are unknown. Here we show, using functional magnetic resonance imaging in three independent experiments, that urban upbringing and city living have dissociable impacts on social evaluative stress processing in humans. Current city living was associated with increased amygdala activity, whereas urban upbringing affected the perigenual anterior cingulate cortex, a key region for regulation of amygdala activity, negative affect and stress. These findings were regionally and behaviourally specific, as no other brain structures were affected and no urbanicity effect was seen during control experiments invoking cognitive processing without stress. Our results identify distinct neural mechanisms for an established environmental risk factor, link the urban environment for the first time to social stress processing, suggest that brain regions differ in vulnerability to this risk factor across the lifespan, and indicate that experimental interrogation of epidemiological associations is a promising strategy in social neuroscience.