Shanghai is a metropolitan city with the highest urbanization rate in China. It is also a coastal city with rich terrestrial–rivershed–marine ecotones that provide diverse types of habitat and food resources for wildlife. However, as a consequence of its rapid urban development over the last four decades, the continuous reduction of urban natural ecological space has led to habitat fragmentation and loss of biodiversity. This chapter analyses the relationship between the built environment and biodiversity at the district level in Shanghai. We performed Pearson’s correlation analysis between the biodiversity variables and development intensity, ecological land and water network variables of each district unit to explore how the urban built environment influences biodiversity at the macroscale. Based on the research results, we propose the following planning suggestions that aim to protect and enhance biodiversity: (1) development intensity control and avoiding construction intrusion in key natural land areas; (2) ascertaining a minimum threshold space of ecological land and defining the specific proportion of each ecological land category; (3) improving the urban ecological river network connectivity. Keywords Biodiversity Built environment Relationships Shanghai High-density metropolitan areas