Xiao Fang was born in 796, during the reign of Emperor Dezong. He came from a prominent clan, descended from the imperial line of Liang Dynasty. Xiao Fang's great-grandfather Xiao Song and grandfather Xiao Hua both served as chancellors, as did his cousin Xiao Mian. Xiao Fang's father Xiao Wu served as a judge at the supreme court. Xiao Fang himself passed the imperial examinations in the Jinshi class in 827, during the reign of Emperor Dezong's great-great-grandson Emperor Wenzong, and he entered governmental service thereafter.
During Emperor Xuānzong's reign
During the Dazhong era of Emperor Wenzong's uncle Emperor Xuānzong, Xiao Fang served successively as Jianyi Daifu and imperial attendant. In 858, there was an occasion when Emperor Xuānzong was set to commission the imperial guard general Li Sui as the military governor of Lingnan Circuit, and had already sent an eunuch to Li Sui's mansion to bestow Li Sui with a staff signifying imperial authority. However, when Xiao received the edict commissioning Li Sui, he, per his authority as imperial attendant, sealed and returned the edict to Emperor Xuānzong, signifying his disagreement. Emperor Xuānzong, when he received the returned edict, was watching a play, but respecting Xiao's disagreement with the commission, he tried to send another eunuch to intercept the eunuch sent to Li Sui's mansion; he could not find one, so instead he sent an actor in the play that he was watching, and the actor was able to stop the eunuch right in front of Li Sui's mansion. Instead of Li Sui, Emperor Xuānzong ultimately commissioned another general, Li Chengxun, and Li Chengxun was able to suppress the rebellions that were then affecting Lingnan. However, on a later occasion, Xiao Fang was accused of having improperly returned an edict to Emperor Xuānzong and was set to be punished. The assistant imperial scholar Kong Wenyu argued that Xiao should be encouraged for his review of edicts, and should not be punished; Emperor Xuānzong agreed and did not punish Xiao. Subsequently, there was a time when the powerful chancellor Linghu Tao recommended Li Zhuo as the commandant of Annan. Li Zhuo was subsequently removed for harshness, and Linghu then wanted to commission Li Zhuo as the governor of Xuanshe Circuit. Xiao, not afraid of offending Linghu, submitted a petition opposing Li Zhuo's commission, and thus was much admired for his honesty. Later, Xiao was himself commissioned to be the military governor of Lingnan, and it was said that while there were many opportunities to collect valuable objects due to Lingnan being a key post for commerce, he refused to do so. On one occasion, when a family member was ill, and the physician ordered that plum be used in the medication; Xiao's attendants took plums that were in the government storage for this purpose, but when Xiao found out, he ordered that the plums be returned.
During Emperor Yizong's reign
Early in the Xiantong era of Emperor Xuānzong's son Emperor Yizong, Xiao Fang was recalled to the capital Chang'an to serve as Zuo Sanqi Changshi, a high-level advisory official at the examination bureau of government. As he considered Emperor Yizong overly devout in Buddhism, in 862, he submitted a petition urging Emperor Yizong to cut back on his display of devotion. Emperor Yizong praised him for his advice, but did not follow it. In 863, he was put in charge of the imperial examinations for that year, and subsequently served successively as the deputy minister of rites and deputy minister of census. He later served for four years as the military governor of Yicheng Circuit and the prefect of Yicheng's capital Hua Prefecture. As Hua Prefecture was situated on the Yellow River, it often suffered from flooding. Xiao carried out a major project moving the course of the Yellow River to an old, more stable course. Emperor Yizong praised him for the project. He was then recalled to be the minister of defense and the director of finances. He then served some time as the minister of civil service affairs and in that capacity selected officials for commissions; he was said to be fair and capable in that capacity. At the end of the Xiantong era, he again became minister of defense and director of finances.
During Emperor Xizong's reign
In 874, by which time Emperor Yizong had died and been succeeded by his young son Emperor Xizong, Xiao Fang, who was then referred to as Zuo Pushe, one of the heads of the executive bureau, was made Menxia Shilang, the deputy head of the examination bureau, and given the designation Tong Zhongshu Menxia Pingzhangshi, making him a chancellor de facto. He was subsequently given the honorific title of Sikong and created the Marquess of Lanling. He died in 875.