People lived on Tokyo Bay in the Paleolithic. When the sea rose in the Jōmon era, the shore ran along what is now the edge of the Imperial Palace, and shell mounds at Ōmori still mark the old waterline. Sensō-ji was founded in 645. The name Edo, "gate of the river", belonged to a fishing village at the mouth of the Sumida, which the Edo clan fortified in the late 12th century. Ōta Dōkan built the first Edo Castle in 1457.
Everything changed after the siege of Odawara in 1590, when Tokugawa Ieyasu was given the Kantō. He became shōgun in 1603 and ruled Japan from Edo, far from the court intrigue of Kyoto, where the emperor stayed. Every feudal lord had to keep a big house in Edo, and at one point these estates covered half the city. The houses are gone, but some of their gardens survive: Rikugien and Koishikawa Kōrakuen are two you can walk into today. By the 18th century Edo had a million people.
Fire kept remaking the city. The Meireki fire of 1657 destroyed two-thirds of its buildings and killed 108,000 people, and townspeople took to calling such blazes the "flowers of Edo". Afterwards the merchant districts moved further east, and the post town of Yotsuya, which had escaped the flames, took in the homeless and a new name: Shinjuku, the "new lodge". Kabuki, ukiyo-e prints and books thrived in these years, and by the 1830s Edo had more than 800 booksellers.
Commodore Perry's arrival in 1853 forced Japan open, prices soared, and within 15 years the shogunate had fallen. In 1868 Edo became Tokyo, the "Eastern Capital", and the emperor moved into the old castle, which became the Imperial Palace. The 1870s brought Ueno Park, the University of Tokyo and Japan's first railway, from Shimbashi to Yokohama. Marunouchi filled up with brick office blocks as the country modernised from here.
Then the city was flattened twice in 22 years. The Great Kantō earthquake of 1 September 1923, and the fires after it, killed about 105,000 people, and Tokyo rebuilt in concrete; the Ginza Line, Asia's oldest subway, opened between Ueno and Asakusa in 1927. On the night of 9 to 10 March 1945, American bombers dropped nearly 700,000 incendiaries on the working-class east end and killed 100,000 civilians. Sensō-ji, Kabuki-za and the main palace building all burned. Between 1940 and 1945 the population fell from 6.7 million to under 2.8 million.
Recovery was fast. In 1964 the Shinkansen began running to Osaka and Tokyo held the first Olympics in Asia, and soon after, the old 31-metre height limit was relaxed; the 147-metre Kasumigaseki Building of 1968 was the first of the towers. At the height of the bubble, in 1990, the Imperial Palace grounds were valued above the whole state of California. The crash that followed began the "Lost Decades", yet the cranes kept working: Roppongi Hills, Shiodome and Odaiba are among the projects. The Olympics came back in 2021, a year late because of COVID-19.