Shi Lang was born to a distinguished lineage in Jinjiang, Fujian and studied military strategy in youth. He was particularly proficient in naval warfare, knowing how to take advantage of wind and tide. After fighting a number of undistinguished operations locally father with him joined Zheng Zhilong's fleet as captain of the left vanguard. Shi Lang served most of the early 1640s in the Zheng family fleet, where he seems to have some conflict with Zheng Zhilong's son Koxinga . When Shi defected to the Qing Dynasty in 1646, Koxinga killed Shi's father, brother and son.
Shi Lang was well-received by the Manchus because of his extensive naval experience and his network of contacts in the major trading ports of East Asia. He accompanied Prince Jidu in 1656 on an expedition in Fujian and attained the rank of Assistant Brigade-General. In the campaign of 1663 against the Zheng family he commanded ships and men to follow up the Manchu victories. In 1668 he submitted a plan to drive the remnants of Ming from Taiwan and the Pescadores but the proposal was not utilised. He was given a post in the Imperial Bodyguard and attached to the Chinese Bordered Yellow .
In 1681, following the Revolt of the Three Feudatories, the sought a possible leader for an amphibious operation against Taiwan. Following the advice of Li Guangdi, he chose Shi Lang. Shi insisted on having an independent command, not one shared with , the Governor-General of Fujian.
On 8th July 1683, after extensive preparation in training men and constructing ships he led a force of 300 warships and 20,000 crack troops out of Tongshan, Fujian, and on July 16-17 defeated the Zheng family's leading naval commander Liu Guoxuan in a major engagement near the . On 5th September Shi received Zheng Keshuang's offer to surrender. On 3rd October he reached Taiwan and formally obtained the capitulation of Liu and Zheng.
Following the campaign, Shi Lang returned to the Chinese mainland and worked hard to persuade the Kangxi Emperor to include Taiwan as a part of China's recognized territory. At the time, there was opposition among many within the Qing government toward the annexation of Taiwan, arguing that its maintenance would become an economic burden on the imperial reserves. However, the Kangxi Emperor accepted Shi Lang's views, and in 1684 Taiwan was divided into three counties and established as a prefecture of Fujian province. Shi Lang was made "General Who Maintains Peace on the Seas" and given the hereditary rank of Marquis. At his own request he was specially granted the privilege of wearing the honorary peacock feather. Shi Lang continued at his post in Fujian and was later charged with arrogance. In 1688 the Kangxi Emperor received him in audience at Beijing and allowed him to sit in the imperial presence, reiterating his confidence in him. Shi returned to Fujian and continued in office until his death in 1696.
He was given the posthumous name of "Xiangzhuang" , the title of Junior Tutor to the Heir Apparent, and in 1732 his name was entered for worship in the Temple of Eminent Statesmen. One of his sons achieved distinction as an admiral whilst another was an official. The Shi family was granted the special privilege of burial in their ancestral cemetery in Jinjiang instead of in Banner lands as was the case with other Bannermen.