Documents preserved in Dunhuang's Library Cave include religious scriptures as well as contracts, accounts, letters, and literature. They offer views of the specific details of medieval life.

Written in several scripts and languages, the documents were later dispersed among institutions. Research often requires comparisons of fragments and related texts across collections.

Opening the Library Cave

The majority of surviving Dunhuang manuscripts were kept in a cave, the so-called Library Cave (Cave 17), which had been walled off sometime early in the 11th century. The documents in the cave were discovered by the Daoist monk Wang Yuanlu, who was interested in restoring the Mogao Caves, on 25 June 1900. In the next few years, Wang took some manuscripts to show to various officials who expressed varying level of interest, but in 1904 Wang re-sealed the cave following an order by the governor of Gansu concerned about the cost of transporting these documents. From 1907 onwards, Wang began to sell them to Western explorers, including British archaeologist Aurel Stein and French sinologist Paul Pelliot.

Stein had the first pick and he was able to collect around 7,000 complete manuscripts and 6,000 fragments for which he paid £130 (equivalent to £13,521 in 2025), although these include many duplicate copies of the Diamond and Lotus Sutras. Pelliot took almost 10,000 documents for the equivalent of £90 (equivalent to £9,361 in 2025), but, unlike Stein, Pelliot was a trained sinologist literate in Chinese, and he was allowed to examine the manuscripts freely, so he was able to pick a better selection of documents than Stein. Pelliot was interested in the more unusual and exotic of the Dunhuang manuscripts, such as those dealing with the administration and financing of the monastery and associated lay men's groups.

Some manuscripts preserve evidence of paper reuse: Buddhist texts were written on the opposite side of sheets bearing earlier writing. Hundreds more of the manuscripts were sold by Wang to Ōtani Kōzui and Sergey Oldenburg.

In addition to the manuscripts that he acquired from Wang, Pelliot also uncovered a large number of manuscripts and printed texts from Caves 464 and 465 (Pelliot's Caves 181 and 182) in the northern section of the site. These documents date to the Yuan dynasty (1271–1368), and are written in various languages, including Chinese, Tibetan, and Old Uyghur. The documents also include over two hundred fragments of texts written in the Tangut language, which is significant as the Tangut script (devised in 1036) is entirely absent from the Library Cave documents.

Languages and scripts

The variety of languages and scripts found among the Dunhuang manuscripts is a result of the multicultural nature of the region in the first millennium AD. The largest proportion of the manuscripts are written in Chinese, both Classical and, to a lesser extent, vernacular Chinese. Most manuscripts, including Buddhist texts, are written in Kaishu or 'regular script', while others are written in the cursive Xingshu or 'running script'. An unusual feature of the Dunhuang manuscripts dating from the 9th and 10th centuries is that some appear to have been written with a hard stylus rather than with a brush. According to Akira Fujieda this was due to the lack of materials for constructing brushes in Dunhuang after the Tibetan occupation in the late 8th century.

The Dunhuang manuscripts represent some of the earliest examples of Tibetan writing. Several styles are represented among the manuscripts, forebears of the later Uchen (dbu can) and Ume (dbu med) styles. Both Old Tibetan and Classical Tibetan are represented in the manuscripts, as well as the undeciphered Nam language and a language that some have identified as the Zhangzhung language.

Other languages represented are Khotanese, Sanskrit, Sogdian, Old Uyghur, and Hebrew, as well as Old Turkic (e.g. Irk Bitig).