The Library of Trantor was one of the prominent features of the fictional planet Trantor, created by Isaac Asimov and appearing in his Empire series and the Foundation series. Located in the Imperial Sector of the planet, it was variously referred to as the Imperial Library of the Galactic Empire, the University of Trantor Library, and the Galactic Library, in which librarians index the entirety of human knowledge by walking up to a different computer terminal every day and resuming where the previous librarian had left off.
Around 260 FE, a rebel leader named Gilmer attempted a coup, in the process sacking Trantor and forcing the Imperial family to flee to the nearby world of Delicass, renamed Neotrantor. After the sack, the population dwindled rapidly from 40 billion to less than 100 million. Most of the buildings on Trantor were destroyed during the sack, and over the course of the next two centuries the metal on Trantor was gradually sold off, as farmers uncovered more and more soil to use in their farms. Eventually the farmers grew to become the sole recognized inhabitants of the planet, and the era of Trantor as the central world of the galaxy came to a close. It began to develop a dialect very different from Galactic Standard Speech, and the people unofficially renamed their planet "Hame", or "home."
As revealed to the reader at the end of Second Foundation, not all these farmers were what they seemed, with the now-rustic Trantor serving as the centre of the Second Foundation. From Trantor, the Second Foundationers secretly guided the development of the Galaxy (roughly parallel to the city of Rome becoming, after the fall of its empire, the headquarters of the Papacy, with its enormous influence on the development of Medieval Europe). Indeed, their self-perception as leaders of the future Second Empire is captured in the Second Foundationers' use of the word "Hamish" to describe the farmers despite reserving for themselves use of the word "Trantorian." It is noted that it was the Second Foundation which ensured that the famed library would survive the sacking to Trantor and the destruction of its urban culture – especially significant, considering that the library was vital to the Second Foundation itself.