Libraries have a long history in China, and there is evidence of organized collections of books dating back to the Han Dynasty (202 BC-220 AD). However, the first true library in China was probably the imperial library, known as the Hanlin Academy, which was established in the 8th century AD during the Tang Dynasty. The Hanlin Academy was a large and comprehensive library that was attached to the imperial palace in Chang’an (present-day Xi’an) and was used by the emperor and his officials to store and consult historical records, legal documents, and other important texts. The library was later expanded and became one of the largest and most important libraries in China. In the following centuries, many other libraries were also established in China, both by the government and by private individuals.