The term Jōkamachi (城下町, "castle town") refers to a type of urban structures in Japan in which the city surrounds a feudal lord’s castle. These cities did not necessarily form around castles after the Edo period; some are known as Jin'yamachi, cities that have evolved around Jin'ya or government offices that are not intended to provide military services. Defined broadly, Jokamachi includes Jin'yamachi. It is also referred to as Jōka as was common before the early modern period.
The advent of Jōkamachi dates back to the Sengoku period (period of warring states). Jokamachi functions both as a military base represented by the castle and an administrative and commercial city. Oda Nobunaga was the biggest contributor to the development of early-modern Jōkamachi. He aimed at promoting Heinobunri (distinguishing the samurai class from the rest by giving privileged status to samurai and disarming farmers and the rest) by forcing the samurai class to live in Jōkamachi, while establishing Rakuichi-rakuza (free markets and open guilds) to stimulate merchandising and trade. Jōkamachi flourished even more under Toyotomi Hideyoshi's regime whose political and commercial epicenter Osaka-jōka became very prosperous as the center of commodities. Osaka continued to be the business center in the Edo period and was called the "kitchen of the land".
Most of the world's walled cities comprise a castle and a city inside the defensive walls. While Japan did have towns and villages surrounded by moats and earth mounds such as Sakai and Jinaicho, Jokamachi initially had moats and walls only around the feudal lord’s castle and did not build walls around the entire city. However, as Jokamachi developed and increased its economic and political value, it demanded protection from wars and turmoil. More and more cities were built with moats and defensive walls, the style of which is known as Sogamae, and gradually came to resemble walled cities.
In the Edo period, Jokamachi served less as a military base and more as a political and economic capital for the Bakufu (government) and Han (domains). This shift was a result of the lack of warfare throughout the Edo period and the fact that most of the Han lords were occasionally transferred from one domain to another and thus had little attachment to the city per se (although crop yields remained matters of attention). Geographical locations that emphasized the castle’s defensive abilities did not necessarily offer good access, and in many cases, as cities increasingly became trade centers, they abandoned their castles and relocated their government base in Jin'ya.
The population of a Jōkamachi, of which nearly 300 existed, is varied. There are large-sized Jōkamachi such as Kanazawa and Sendai with approximately 120,000 residents, samurai and merchants combined, while there are small-sized Jōkamachi like Kameda in the Tohoku area with around 4,000 people. In many cases, the population is somewhere around 10,000.
The design of a Jōkamachi aimed to stimulate commerce by reworking the closest main road to pass through the city so that traffic occurs within the Jōka. The main road passed through the front of the castle rather than the back to demonstrate power of the authority, regardless of geographical concerns that might exist.
Jōkamachi incorporated various ideas to strengthen the city’s defense. To prevent invasions, it cleverly used rivers and other terrains, dug moats, built earth mounds and stone walls, and sometimes constructed heavy gateways like Masugata gates if the city was deemed strategically important. Inside the Jōka, houses were tightly located on either side of the main street to make it harder to directly view the castle, and roads were cranked or had dead ends to elongate the route to the castle. Smaller sections of the city built fences and wooden gates shutting them at night with guards to ward off intruders. Moats were also used as canals and played a large role in distribution of goods.
These cities tended to exist around river terraces in eastern Japan and deltas facing the ocean in western Japan, while cities like Hikone, Zeze, and Suwa are adjacent to a lake as part of the "lake type" Jōkamachi.
Within a Jōkamachi, smaller districts like Samurai-machi, Ashigaru-machi, Chōnin, and Tera-machi surrounded the castle. A Samurai-machi is a district for samurai’s compounds also known as Samurai-yashiki. In principle, higher-ranked vassals owned a compound closer to the castle. Modern towns with names like Sange, Kamiyashiki-machi, Shitayashiki-machi are descendants of Samurai-machi. People at a lower status like Ashigaru were often forced to live at the outer rim of Chōnin districts. Today, towns with names like Banchō, Yuminochō, and Teppochō tend to be what were originally Ashigaru-machi.
Chōnin-chi (Chonin district) is a district that lay outside of Samurai-machi for merchants and craftsmen. Villagers who lived near the Jokamachi resided in Chonin-chi when they moved in. Merchants and craftsmen were allocated according to their occupation. Towns today with names like Gofuku-machi ("apparel town"), Aburaya-cho ("oil town"), Daiku-machi ("carpenter town"), Kaji-machi ("blacksmith town"), and Kōya-chō ("dye-shop town") are remnants of Chōnin-chi. Chōnin-chi was smaller in land size per family compared to Samurai-machi and were tightly aligned along the streets. This is why a Chōnin house had a narrow entrance and great depth and was called an "eel's nest". It had two floors, but the second floor was used as a storeroom to avoid looking down at the feudal lord.
Tera-machi was placed on the outer rim of the Jokamachi and formed an array of large temples. It contributed to reinforcing the city’s defense.
In Japan today, more than half of its cities with a population of over 100,000 are former Jōkamachi. Their appearances have changed through great fires, war damage, and urban development. Cities with any signs of the original Jōkamachi are decreasing, and those that have preserved the entire area are very few. However, many former Jōkamachi have preserved remnants of the old city design albeit partly, and cities with streets originally designed to hamper foreign intruders are indeed causing traffic congestion today. Modern cities often have other traces of Jōkamachi such as former Chōnin-chi districts that still function as the city center as well as festivals and traditions that have continued since the Jōkamachi era. Cities that have kept its design from before the Edo period are often called Sho-kyoto ("small Kyoto"). Cities with remnants of the Edo period are sometimes called Ko-edo ("small Edo").