The Shanhaijing 山海经 "Classic of mountains and seas" is a kind of early geography of China. The modern version has 18 juan "scrolls" and consists of four parts describing "mountains" (Shanjing 山经), "seas" (Haijing 海经), "the great wilderness" (Dahuangjing 大荒经), and China herself (Haineijing 海内经). Another arrangement divides the book into two parts, the Shanjing 山经 or Wucang shanjing 五藏山经 which consists of five geographical chapters, and the Haijing 海经 which consists of the parts Haiwaijing 海外经, Haineijing 海内经 (four chapters each) and Dahuangjing 大荒经 (five chapters). Authorship is traditionally attributed to Emperor Yu 禹, the mythological founder of the Xia dynasty 夏 (17th to 15th cent. BCE), or Bo Yi 伯益, one of his ministers, or is said to be a chart of the ding 鼎 cauldrons Yu the Great erected in the provinces of China. Modern scholars believe that the book was compiled during the late Warring States 战国 (5th cent. - 221 BCE) and Han 汉 (206 BCE-220 CE) periods and is the product of a long time of compilation.

The first two parts of the book can be seen as Daoist writings. The first part deals with mountais and their nature and character, plants, animals and ores, all being features relevant for the ideal performance of Daoist shamans working there. It was probably compiled during the 4th and 3rd centuries BCE. The second part deals with foreign countries and its inhabitants and contains a lot of mythological stories and tales about strange persons and animals. It was probably written during the late 3rd or the 2nd centuries BCE. The last two parts were originally supplements compiled by the Former Han period 汉 (206 BC-8 AD) scholars Liu Xiang 刘向 or Liu Xin 刘歆. Only when Guo Pu 郭璞 started compiling his commentary during the 4th century the supplements were dealt with as proper parts of the classic.

Although the stories told in the Shanhaijing are historically not reliable they are valuable sources for the study of early Chinese mythology, and eventually for the origin of certain parts of Chinese popular religion. The Yellow Emperor 黄帝, for example, can be found out to have been a deity venerated in western China. TheShanhaijing is a rich source of information on early Chinese history, geography, astronomy, climate, religion, customs and habits, animals and plants, minerals, medicine, rivers and marine sciences. In the earliest bibliography Qilüe 七略 theShanhaijing was classified as a writing of divinatory (shushu 数术) character, yet from the Tang period 唐 (618-907) on it was seen as a geographical book. During the Song period 宋 (960-1279) the many superstitional and fictional accounts were the reason for its categorization as a book of cosmological character (wuxing 五行). In later ages the Shanhaijing was seen as a collection of phantastic stories and can be seen as the ancestor of Chinese novellas and fiction (xiaoshuo 小说).

Guo Pu's commentary to the Shanhaijing is the oldest. During the Qing period 清 (1644-1911) Hao Yixing 郝懿行 wrote a commentary, the Shanhaijing jianshu 山海经笺疏. Less important commentaries were written by Yang Shen 杨慎, Wang Chongqing 王崇庆, Wang Niansun 王念孙, He Zhuo 何焯, Wu Renchen 吴任臣 and Bi Yuan 毕沅. The most recent commentary is Yuan Ke's 袁珂 Shanhaijing jishi 山海经集释 from 1980.

The Shanhaijing is to be found in the Daoist Canon Daozang 道藏 and thecollectanea Gujin yishi 古今逸史, Siku quanshu 四库全书, Gezhi congshu 格致丛书,Ershierzi 二十二子, Baizi quanshu 百子全书, Mishu ershiyi zhong 秘书二十一种, Sibu congkan 四部丛刊, Sibu beiyao 四部备要 and Longxi jingshe congshu 龙溪精舍丛书.