A city official told the Shanghai News: "Unlicensed internet cafes avoid paying taxes and disseminate pornographic CDs which corrupt the minds of young people."
One owner of a legal cafe welcomed the crackdown, saying she had been losing business to illegal competitors.
Hu Weiping told Reuters: "They normally operate at dodgy places with cheap rents and computers and charge about half of our price."
There are about 750 internet cafes in Shanghai and they are sprouting across China, where the number of internet users has reached 9m and is growing fast.
One reason internet cafes are so popular is that home computer ownership in China is still very low, and obtaining a fixed line telephone in many areas is still slow and expensive.
A visit to an internet cafe in Shanghai was one of the highlights of a trip to China in 1998 by US President Bill Clinton.
But last Wednesday, in another tightening of restrictions on the internet in China, new regulations designed to stop the leak of "state secrets" were introduced.
State secrets
The new rules make operators of internet bulletin boards, chat rooms and news groups responsible for any security breach.
The regulations even cover e-mail, and give authorities a powerful weapon against the internet since China's definition of state secrets is so broad it can encompass virtually any information not approved for publication.
The charge of leaking state secrets is often used to jail opponents of the Communist Party.
The Shanghai Daily said last week the State Press and Publication Administration was crafting rules that would pose a "major challenge" for domestic websites, including preventing them from hiring their own reporters.
In another attempt to bring the internet under official scrutiny, authorities are demanding all companies and individuals officially register for approval to use encryption technology, which protects electronic communication from eavesdropping.