# Demographics of Shanghai

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.

## Population

About 9 million out of the 23 million residents of Shanghai, or more than 39%, are long-term migrants, triple the 3 million in 2000. The main origins of the migrants are Anhui (29.0%), Jiangsu (16.8%), Henan (8.7%), and Sichuan (7.0%) provinces, and 79% are from rural areas. They account for the entire population increase as Shanghai's natural growth rate has been negative since 1993 due to its extremely low fertility rate — just 0.6 in 2010, probably the lowest level anywhere in the world.
98.2% of Shanghai's residents are of the Han Chinese ethnicity, while 1.2% belong to various minority groups. However, the minority population has grown by 165.54% since 2000, much faster than the overall population growth.
According to the Shanghai Municipal Statistics Bureau, there were 152,050 officially registered foreigners in Shanghai as of 2009, an increase of 50% from 100,011 in 2005. The three largest foreign nationalities were Japanese (31,490), American (21,284) and Korean (20,700). Note that these statistics only show officially registered residents, and that the actual number of foreign citizens living in Shanghai is likely much higher. For example, by 2009, the South Korean community in Shanghai increased to more than 70,000 according to Xinhua. Some foreign expatriates are staying in Shanghai as long-term settlers, renewing Shanghai's reputation as China's global city.
According to the 2010 census, 208,300 people from outside of mainland China resided in Shanghai. That included 143,200 foreigners (which is about 1/4 of all foreigners residing in mainland China), as well as 44,900 from Taiwan, 19,300 from Hong Kong, and 910 from Macau. Some authors estimated the Taiwanese community of Shanghai as much larger than what the census reported; 2010 estimates vary around 700,000.
The life expectancy of Shanghai's registered residents in 2010 reached 82.13 years (79.82 for men and 84.44 for women), the highest in mainland China and higher than all but a few countries in the world. In the same year, the maternal mortality rate in Shanghai was 9.61 per 100,000, while the infant mortality rate dropped to 5.97 per 1,000 from 6.58 in 2009. Due to the combination of high life expectancy and low fertility rate, there is a serious aging problem among Shanghai's registered residents: as of 2009 only 8.3% of the total were under the age of 14, while 22.54% were over 60.
In 2015 the city had 24.15 million residents, including 14.33 million with Shanghai hukou (household registration) and 9.82 million permanent migrants; the migrants made up 40.6% of the permanent residents in Shanghai. A cap on the number of migrants allowed caused their population to decrease by 1.5% from 2014 to 2015, and their share of the total population declined by 0.5%. This caused Shanghai's overall population to decrease by 104,100 in that period. The number of people with Shanghai hukou increased by 43,600 in 2014–2015. Similar to Beijing, the city's population is capped at 25 million as part of a 2017-2035 master plan.

## Language

Historically Shanghainese was the preferred native tongue and the lingua franca of Shanghai until 1990s. By 2016 the use of Shanghainese declined since the influx of Chinese from other parts of China forced Shanghainese to use Mandarin more often in conversations, so people who are not locals are able to understand conversations, and because the government(s) placed restrictions against Shanghainese, and other Chinese varieties, on television and in schools. Prior to the 1990s elementary school children were permitted to use Shanghainese, but increasing restrictions against Shanghainese in schools were put in place. About 40% of Shanghainese residents below the age of 18 cannot speak the language fluently. According to a recent study, around half of the children in Shanghai will not be able to speak Shanghainese in one or two decades.

## Ethnic groups
### Uyghurs

The majority of Shanghai Uighurs are young to middle aged men. Older Uighur men have marriages with Uighur women. Most of the Shanghai Uighurs who are under 35 years of age are single. The vast majority of Uighurs in Shanghai are male. The Uighur women had moved with husbands and are a small part of the population. In 2007 Blaine Kaltman, author of Under the Heel of the Dragon: Islam, Racism, Crime, and the Uighur in China, wrote that the majority of Shanghai Uighur "seem to be childless" and Han children, parents, and teachers indicated that no Uighur students are enrolled in schools in proximity to Uighur areas. Kaltman wrote that most of the Uighurs stated that they came to Shanghai to gain legitimate employment and that most of them "seem to be unemployed". According to Kaltman, most Uighurs stated that they go back to Xinjiang periodically.