Abstract Ultra-fine Ta4HfC5 and TaHfC2 powders were prepared through the pyrolysis of a precursor synthesised by using a facile one-pot reaction. HfCl4, TaCl5, and phenolic resins were used as the sources of hafnium (Hf), tantalum (Ta), and carbon (C), respectively. The as-synthesised precursors were further utilised to prepare Ta4HfC5- and TaHfC2-modified carbon/carbon (C/C-Ta4HfC5 and C/C-TaHfC2) composites through precursor infiltration and pyrolysis. The transformation of Ta4HfC5 and TaHfC2 precursors into ultra-fine ceramic powders and anti-ablation performance of the C/C-Ta4HfC5 and C/C-TaHfC2 composites were investigated. The carbothermal reduction of Ta2O5 and Hf6Ta2O17 and the solid solution reaction between HfC and TaC occur successively during the pyrolysis of Ta4HfC5 precursors. HfC and TaC undergo a sufficient solid solution reaction at 1800 °C to form the Ta4HfC5 solid solution with a particle size of 200–300 nm. The pyrolysis products of TaHfC2 precursors acquired at 1400–1600 °C are composed of TaC, HfC and TaHfC2. High-temperature pyrolysis promotes the solid solution reaction between TaC and HfC. The TaHfC2 solid solution with a particle size of 100–150 nm is formed at 1800 °C. The introduction of TaHfC2 and Ta4HfC5 solid solutions into the C/C composite substantially enhances their anti-ablation performance. The linear ablation rates of C/C-Ta4HfC5 and C/C-TaHfC2 are 11.04 and 16.97 μm/s, respectively, which are considerably lower than that of the C/C composite. The good anti-ablation performance of the C/C-Ta4HfC5 and C/C-TaHfC2 composites can be attributed to the formation of the Ta2O5 and Hf6Ta2O17.