The Haijin (Chinese: 海禁; pinyin: Hǎijìn; literally: "sea ban") order was a ban on maritime activities imposed during China's Ming dynasty and again at the time of the Qing dynasty. Intended to curb piracy, the ban proved ineffective for that purpose. Instead it imposed huge hardships on coastal communities and legitimate sea traders.
The Ming Hongwu Emperor was the first to propose a policy to ban all maritime shipping in 1371.
The Haijin policy consisted of three strategies: build a navy of 110,000 to defend coastal provinces; engage with the Japanese authorities to curtail the raiders; regulate maritime trade to control smuggled goods.
The ban was lifted in 1405, reinstated in 1550 then lifted again in 1567.
The earliest possible date for implementation of the policy was 1368, the year that the Ming dynasty came to power whilst the latest possible year when it was terminated was 1567.
Koxinga, also known as Zheng Chenggong, was an ex-Ming military leader located in the coastal region, a Ming loyalist, and a threat to Qing authority. In 1647, another sea ban was issued to limit foreign trade with severe punishment imposed. In 1655 the "Frontier Shift" was imposed in Guangdong, Fujian, Zhejiang, Jiangsu and Shandong. It required coastal residents to move inland 30–50 li (~15 to 25 kilometres (9.3 to 15.5 mi)). All private boats and ships were burned. Small rafts were not allowed at sea. In 1684, the ban was lifted and trading resumed under the Kangxi Emperor. In 1685 a were made subject to the "Taxation Rules for Sea Trade" as drafted by Yiergetu.