The US State Department also advised Americans to reconsider travelling to China "due to Covid-19-related restrictions, including the risk of parents and children being separated."
The US has ordered all non-emergency consular staff to leave Shanghai, which is under a tight lockdown to contain a Covid-19 surge.
The State Department said the order announced late on Monday is an upgrade from the “authorised” departure advisory last week that made the decision voluntary.
The order covers non-emergency US government employees at the consulate in Shanghai and their family members.
“Our change in posture reflects our assessment that it is best for our employees and their families to be reduced in number and our operations to be scaled down," the announcement said.
The State Department also issued a series of advisories for Americans in Shanghai to have a “sufficient supply of money, medication, food, and other necessities... in the event of sudden restrictions or quarantine."
Many residents in the city of 26 million have been confined to their homes for up to three weeks as China maintains its “zero-Covid” strategy of handling outbreaks with strict isolation and mass testing.
But people living under the restrictions have described an increasingly desperate situation, with families unable to leave their homes or obtain food and daily necessities.
Reports also who people who test positive for the coronavirus have been forced into mass quarantine centres where conditions at times have been called crowded and unsanitary.
Beijing responded angrily to last week's voluntary departure advisory.
Foreign Ministry spokesperson Zhao Lijian said China was “strongly dissatisfied with and firmly opposed to the US side’s groundless accusation against China’s epidemic response.”
Shanghai says it will gradually lift some restrictions on neighbourhoods where no new infections have been reported over the past two weeks.
Residents will be able to travel around their districts but not meet in groups. Others will be restricted to their immediate neighbourhoods.