We determine the reaction phase diagram and the transformation mechanism of (5,5) and (10,10) single-walled carbon nanotube bundles up to 20 GPa and 4000 K. We use Monte Carlo simulations, based on the state-of-the-art reactive potential LCBOPII, that incorporates both covalent and van der Waals interactions among the tubes. At low temperature, upon increasing pressure, large (10,10) nanotubes first collapse and then coalesce, yielding almost perfect graphitic structures. In contrast, small (5,5) nanotubes do not collapse, but coalesce and transform to graphite via a mixed graphite-tube structure. At high temperature (above ∼2000 K), for both (10,10) and (5,5) nanotubes, coalescence dominates the transformation to graphitic structures. We argue that the sp 3 -interlinking defects appearing at coalescence can act as seed and facilitate the transformation to diamond structures.