Kong Wei (孔緯) (died October 1, 895), courtesy name Huawen (化文), formally the Duke of Lu (魯公), was an official of the late Tang dynasty, serving as a chancellor during the reigns of Emperor Xizong and Emperor Xizong's brother Emperor Zhaozong.
Kong Wei's family was descended from the Spring and Autumn period philosopher Kong Qiu (Confucius). His great-granduncle Kong Chaofu (孔巢父) was a well-known official during the reign of Emperor Dezong, and his great-grandfather Kong Cenfu (孔岑父) and grandfather Kong Kui (孔戣) also both served as imperial officials. His father Kong Wenru (孔溫孺) served as a county secretary genera, but died earlyl. Kong Wei had at least two younger brothers, Kong Jiang (孔絳) and Kong Jian (孔緘).
As Kong Wenru died early, Kong Wei was raised by his uncles Kong Wenyu (孔溫裕) and Kong Wenye (孔溫業). As both Kong Wenyu and Kong Wenye served as regional governors, Kong Wei followed them to their assignments, and due to the friendships that Kong Wenyu and Kong Wenye had, Kong Wei became well known among the imperial officials. He passed the imperial examinations in the Jinshi class in 859, during the reign of Emperor Xuānzong, and therefore served as a copyeditor (校書郎, Xiaoshu Lang) at the Palace Library. When the former chancellor Cui Shenyou served as the military governor (Jiedushi) of Dongchuan Circuit (東川, headquartered in modern Mianyang, Sichuan), he invited Kong to serve on his staff. Kong later served on the staff of another former chancellor, Cui Xuan, when Cui Xuan served as the military governor of Huainan Circuit (淮南, headquartered in modern Yangzhou, Jiangsu). He then served under Cui Shenyou again at Hua Prefecture (華州, in modern Weinan, Shaanxi) and then Hezhong Circuit (河中, headquartered in modern Yuncheng, Shanxi). Under the recommendation of the chancellor Yang Shou, Kong was made the sheriff of Chang'an County, one of the two counties making up the Tang Dynasty capital Chang'an, and also served as a researcher at Hongwen Pavilion (弘文館). Later, Wang Duo, who was then the deputy chief imperial censor, recommended Kong to be an imperial censor with the title Jiancha Yushi (監察御史), and Kong was then made Libu Yuanwailang (禮部員外郎), a low-level official at the ministry of rites (禮部, Lǐbu). The chancellor Xu Shang then recommended that he be made a scholar at Jixian Hall (集賢院) as well as Kaogong Yuanwailang (考功員外郎), a low-level official at the minister of civil service affairs (吏部, Lìbu, note different tone than the ministry of rites).