The Shanghai Xianzhi or "Shanghai Gazetteer" () is an ancient gazetteer for the city of Shanghai. It is one of the numerous xianzhi (, "county gazetteers") that were produced in China in ancient times.

An edition of the Shanghai Xianzhi is known from 1524.

Another such document at the municipal rather than city level is the Shanghai Zhi ().

Notes