Tō-ji was founded in the early Heian period. The temple dates from 796, two years after the capital moved to Heian-kyō. Together with its partner Sai-ji, and the temple Shingon-in, it was one of only three Buddhist temples allowed in the capital at the time, and is the only of the three to survive to the present. It once had a partner, Sai-ji and, together, they stood alongside the Rashomon, gate to the Heian capital. It was formerly known as Kyō-ō-gokoku-ji which indicates that it previously functioned as a temple providing protection for the nation. Tō-ji is located in Minami-ku near the intersection of Ōmiya Street and Kujō Street, southwest of Kyōto Station. Tō-ji is often associated with Kōbō Daishi. Though Tō-ji began to decline in the end of Heian period, it came back into the spotlight with the rise of Daishi Shinko in the Kamakura period. The well-known Buddhist priest was put in charge of Tō-ji in 823 by order of Emperor Saga. The temple's principal image is of Yakushi Nyorai, the Medicine Buddha. Many religious services for Daishi are held in Miei-dō, the residence of Kōbō Daishi.
The five-storied Pagoda of Tō-ji dates from 1643, when it was rebuilt by order of the third Tokugawa Shōgun, Iemitsu. The original pagoda was built in the 9th century, but it was destroyed and rebuilt four times before reaching its current state. It was designated a National Treasure in 1952. The pagoda stands high, and is the tallest wooden tower in Japan. Entrance into the pagoda itself is permitted only on special occasions, but it is usually open and the interior can be seen from the outside. It houses relics, sculptures and paintings. At ground level there are statues of four Buddhas facing different directions.
The Kondo or Golden Hall is the main hall of the temple, and contains a statue of Yakushi from 1603.
The Miedo is dedicated to Kobo Daishi, also called Kukai, the temple's founder. It stands on the location of his original residence. The hall is opened on the 21st of each month, when a memorial service is held for Kukai.
The grounds feature a garden and pond, in which turtles and koi swim. The grounds also house an academically rigorous private school, Rakunan, from which many students are sent to elite universities.
Tō-ji was rebuilt in the late Edo Period, verging on the Kamakura Period. During this rebuild, Tō-ji was dedicated to be a ShingonBuddhist temple. These temples were typically built in the mountains and utilized more natural and demographic design elements, dictating the resulting architectural layout. In the Kamakura period, Japanese architects began to utilize technology to resist damage from earthquakes, rainfall, sun and heat damage. These fortifications were integrated into the remodeling of Tō-ji. This style of building of defending against the natural elements evolved into the Zenshūyō style, seen later on in the Kamakura period. This style utilizes the "hidden roof" innovation. Zenshūyō style temples, such as Tō-ji, are characterized by linear spacing outlines of the Garan, hinging panel doors, cusped windows called Katōmado, and decorative pent roofs called Mokoshi. Although containing many of the elements of Zenshūyō style architecture, the Tō-ji temple uses the natural land around it to dictate the layout of the garan, which is a technique used in the Heian Period and Edo Period of Japanese Architecture. This correlates with the Shingon attribution by Emperor Saga in 823. The decorative mokoshi and outfitting of modern structural technology, was most likely integrated during the remodeling of the tower in the Kamakura Period. Recognizing the historical and spiritual significance of Tō-ji, UNESCO designated it, along with several other treasures in Kyoto Prefecture, as part of the "Historic Monuments of Ancient Kyoto" World Heritage Site.
On the 21st of each month, a famous flea market is held on the grounds of Tō-ji. This market is popularly called Kōbō-san, in honor of Kōbō Daishi, who died on March 21. The flea market features a variety of antiques, art, clothes, pottery, some food, and typical second-hand flea market goods. By far the largest market is held on December 21, as it is the last of the year. A similar market is held on the 25th of every month at Kitano Tenmangū, also called Tenjin. A Kyoto proverb proclaims, "Fair weather at Tō-ji market means rainy weather at Tenjin market", calling to mind Kyoto's fickle weather. A smaller, less-crowded, antique-oriented market is held at the Tō-ji grounds on the first Sunday of each month.
The Rashomon was formerly situated to the west of Tō-ji, though now only a marker remains, reachable a short walk west along Kujō street. A little further west was Sai-ji, though now only a small park remains. Tō-ji and Sai-ji were built at the southern edge of the capital, and were the only Buddhist temples officially allowed in Heian-kyō at the time. Sai-ji disappeared in the 16th century. The reason was bad irrigation of Ukyō-ku and the lack of funds to maintain it. A legend says that at the time of a great drought, Kūkai, the priest at Tō-ji, and Shubin, his colleague at Sai-ji, were both praying for the rainfall. Kūkai succeeded where Shubin had failed, and Shubin, envious, shot an arrow at Kūkai. At that time a Jizō appeared and took the arrow instead of Kūkai, saving his life. You can find the Jizō in question near the ruins of Rashōmon. It has been chipped where the arrow hit it.