Historical population| Year | | |
|---|
| 1953 | 5,258,210 | — |
|---|
| 1964 | 6,423,017 | +22.2% |
|---|
| 1982 | 6,320,829 | −1.6% |
|---|
| 1990 | 8,348,299 | +32.1% |
|---|
| 2000 | 14,489,919 | +73.6% |
|---|
| 2010 | 20,555,098 | +41.9% |
|---|
| 2020 | 22,209,380 | +8.0% |
|---|
| Source: Census in China |
Resident foreigners in Shanghai
| Country of origin | Population (2012) | Population (2013) | Population (2017) |
| Japan | 39,091 | 37,671 | 28,870 |
| United States | 26,000 | 26,279 | 21,903 |
| South Korea | 20,456 | 20,578 | 20,823 |
| France | 9,472 | 9,828 | 8,659 |
| Germany | 8,680 | 8,948 | 7,583 |
| Canada | 7,669 | 7,832 | 7,439 |
| Australia | 6,545 | 6,917 | 6,995 |
| United Kingdom | 6,196 | 6,547 | 5,993 |
| Singapore | 6,935 | 6,717 | 5,786 |
The 2010 census put Shanghai's total population at 23,019,148, a growth of 37.53% from 16,737,734 in 2000. 20.6 million of the total population, or 89.3%, are urban, and 2.5 million (10.7%) are rural. Based on population of total administrative area, Shanghai is the second largest of the four direct-controlled municipalities of China, behind Chongqing, but is generally considered the largest Chinese city because Chongqing's urban population is much smaller.