A Paleolithic culture from around 30,000 BC constitutes the first known habitation of the islands of Japan. This was followed from around 14,500 BC (the start of the Jōmon period) by a Mesolithic to Neolithic semi-sedentary hunter-gatherer culture characterized by pit dwelling and rudimentary agriculture. Decorated clay vessels from the period are among the oldest surviving examples of pottery. From around 1000 BC, Yayoi people began to enter the archipelago from Kyushu, intermingling with the Jōmon; the Yayoi period saw the introduction of practices including wet-rice farming, a new style of pottery, and metallurgy from China and Korea.
Japan first appears in written history in the Chinese Book of Han, completed in 111 AD. The Records of the Three Kingdoms records that the most powerful state on the archipelago in the 3rd century was Yamato; according to legend, the kingdom was founded in 660 BC by Emperor Jimmu. Buddhism was introduced to Japan from Baekje (a Korean kingdom) in 552, but the subsequent development of Japanese Buddhism was primarily influenced by China. Despite early resistance, Buddhism was promoted by the ruling class, including figures like Prince Shōtoku, and gained widespread acceptance beginning in the Asuka period (592–710).
After defeat in the Battle of Baekgang by the Chinese Tang dynasty, the Japanese government devised and implemented the far-reaching Taika Reforms. It nationalized all land in Japan, to be distributed equally among cultivators, and ordered the compilation of a household registry as the basis for a new system of taxation. The Jinshin War of 672, a bloody conflict between Prince Ōama and his nephew Prince Ōtomo, became a major catalyst for further administrative reforms. These reforms culminated with the promulgation of the Taihō Code, which consolidated existing statutes and established the structure of the central and subordinate local governments. These legal reforms created the ritsuryō state, a system of Chinese-style centralized government that remained in place for half a millennium.
The Nara period (710–784) marked an emergence of a Japanese state centered on the Imperial Court in Heijō-kyō (modern Nara). The period is characterized by the appearance of a nascent literary culture with the completion of the Kojiki (712) and Nihon Shoki (720), as well as the development of Buddhist-inspired artwork and architecture. A smallpox epidemic in 735–737 is believed to have killed as much as one-third of Japan’s population. In 784, Emperor Kanmu moved the capital from Nara to Nagaoka-kyō, then to Heian-kyō (modern Kyoto) in 794. This marked the beginning of the Heian period (794–1185), during which a distinctly indigenous Japanese culture emerged. Murasaki Shikibu‘s The Tale of Genji and the lyrics of Japan’s national anthem “Kimigayo” were written during this time.