Pyrolysis technology is a promising way to convert sludge to char, tar, and gas. As the ash content in sludge can reach more than half, the influence of metals (alkali and alkaline earth metals, Fe) on the pyrolysis process and tar distribution was studied by comparing the raw sludge, stepwise pickling sludge, and metal-loaded sludge pyrolysis. The results show that the maximum weight loss rate temperature of the sludge moved to the high-temperature zone, from 270 degrees C (raw sludge) to 299-338 degrees C (pickling sludge). The activation energy also increased after pickling. The presence of metals has a catalytic effect on the thermal decomposition of the sludge. Moreover, the total amount of the tar is increased by 32.47%, 138.41%, and 240.59% for pickling sludge treated with different acids (HCl, HF, and HCl + HF, respectively). The cracking performance of metals on tar is related to their type and loading amount. Fe exhibits a strong cracking ability for sludge volatiles, although its loading content is the lowest. Mg reduces the total amount of tar by 71.89%. Also, the cracking rate of aliphatic and aromatics is lower than that of oxygen-containing compounds under the action of the same metals. Metals can crack the oxygen-containing compounds, aromatics, and aliphatics into smaller ones through deoxygenation or the cracking of an aliphatic side chain. Among them, Na has the ability to promote the formation of alcohols by reacting with oxygen-containing functional groups, such as hydroxyl and carbonyl, in compounds. Meanwhile, K, Ca, Mg, and Fe can cause alcohols to undergo cracking and transform into small molecular compounds. Metals in sludge play a crucial role in the formation of tar during pyrolysis.