Sakoku (鎖国?, "closed country" but commonly translated as "period of national isolation") was the foreign relations policy of Japan under which severe restrictions were placed on the entry of foreigners to Japan and Japanese people were forbidden to leave the country without special permission, on penalty of death if they returned. The policy was enacted by the Tokugawa shogunate under Tokugawa Iemitsu through a number of edicts and policies from 1633–39 and largely remained officially in effect until 1866, although the arrival of the American Black Ships of Commodore Matthew Perry, which started the opening of Japan to Western trade, eroded its enforcement severely.
It was preceded by a period of largely unrestricted trade and widespread piracy when Japanese mariners travelled Asia and official embassies and envoys visited both Asian states, New Spain (now Mexico), and Europe. This period was also noted for the large number of foreign traders and pirates who were resident in Japan and active in Japanese waters.
The term Sakoku originates from the manuscript work Sakoku-ron (「鎖国論」?) written by Japanese astronomer and translator Shizukiti Tadao () in 1801. Shizuki invented the word while translating the works of the 17th-century German traveller Engelbert Kaempfer concerning Japan.
Japan was not completely isolated under the sakoku policy. It was a system in which strict regulations were applied to commerce and foreign relations by the shogunate, and by certain feudal domains (han). The policy stated that the only European influence permitted was the Dutch factory at Dejima in Nagasaki. Trade with China was also handled at Nagasaki. Trade with Korea was limited to the Tsushima Domain (today part of Nagasaki Prefecture). Trade with the Ainu people was limited to the Matsumae Domain in Hokkaidō, and trade with the Ryūkyū Kingdom took place in Satsuma Domain (present-day Kagoshima Prefecture). Apart from these direct commercial contacts in peripheral provinces, trading countries sent regular missions to the shogun in Edo and Osaka Castle.