There is a large consensus among international institutions and national governments to favor urban-containment policies - the compact city - as a way to reduce the ecological footprint of cities. This approach overlooks the following basic trade-off : the concentration of activities decreases the ecological footprint stemming from commodity shipping between cities, but it increases emissions of greenhouse gas by inducing longer worktrips. What matters for the ecological footprint of cities is the mix between urban density and the global pattern of activities. As expected, when both the intercity and intraurban distributions of activities are given, a higher urban density makes cities more environmentally friendly and raises global welfare. However, once we account for the fact that cities may be either monocentric or polycentric as well as for the relocation of activities between cities, the relationship between density and the ecological footprints appears to be much more involved. Indeed, because changes in urban density affect land rents and wages, firms are incited to relocate, thus leading to new commuting patterns. We show policies that favor the decentralization of jobs in big cities may reduce global pollution and improve global welfare.