Zhang was originally a landlord and a member of a powerful lineage involved in salt-smuggling. In 1852 he was chosen to lead the Nien, and in 1856 was bestowed with the title "Lord of the Alliance" when the Nien organised themselves under a banner system inspired by the Eight Banners of the ruling Qing Dynasty. Zhang also at this time claimed the title of "Great Han Prince with the Mandate of Heaven". He later joined forces with the Taiping Rebellion and became the "Commander of the Northern Expedition".
In 1863 he was defeated and captured along with his son and adopted son by Mongol cavalry general Sengge Rinchen. Prior to being executed, he confessed that he could no longer remember how many places he had plundered; he also claimed to not know the whereabouts of his wife, who had been chased off by government troops, or his brother Zhang Minxing, who had left for the southwest along with several thousand men, and that other Nien leaders had already been killed.
Despite the apparent loss of leadership, the Nien rebellion would continue for another five years. Zhang's nephew Zhang Zongyu succeeded him in command of the Nian armies. Sengge Richen being killed in a Nien ambush only two years after Zhang's death.