The long-term evolution of the deep Earth depends on its initial temperature and composition. These were set by the large planetary collisions that formed the Earth. After each collision, the metallic core of the impactor fell into a molten silicate magma ocean. Previous investigations showed that, as it sank, the impactor core fragmented into drops. The overall fragmentation of the core controlled the efficiency of chemical transfers between the impactor metal and the magma ocean, and, as a consequence, the composition of the Earth's core and mantle. However, because previous studies lack an impact stage, it is unclear whether the projectile core fragmented during the impact at Earth's surface, or deeper in the magma ocean.To answer this question, we conduct laboratory experiments modeling the collision of single-phase and two-phase impactors. In a first series of experiments, we investigate the impact of a single-phase centimetric liquid volume, representing the impactor core, onto a lighter immiscible liquid, representing the magma ocean. Our experiments approach the dynamical regime of planetary collisions for which inertia is large compared to surface tension. Varying the velocity and size of the impactor, we determine the conditions under which the impactor fragments into drops. We find that fragmentation occurs when the Froude number, which measures the relative importance of inertia to gravity, is larger than 40, regardless of surface tension. This fragmentation results from the growth of a turbulent Rayleigh-Taylor instability at the interface between the impacting liquid and the target pool. In contrast, when Fr<10, the impactor remains coherent. In a second series of experiments, we use two-phase impactors to show that these results hold for impactors that are differentiated into a core and a mantle.Applied to planet formation, our results suggest that the core of impactors less than 330 km in radius impacting at the escape velocity onto an Earth-sized planet fully fragments into droplets during the impact process, whereas the core of a giant Mars-sized impactor remains coherent. We derive a model for the depth at which the impactor core fragments in the magma ocean as a function of the impactor size and velocity. This model predicts that impactors with a radius less than 800 km fully fragment before reaching the bottom of the magma ocean. For velocities higher than twice the escape speed, some degree of fragmentation is unavoidable for any impactor size.