The cooling rate of magma in the presence of external water during phreatomagmatic and submarine eruptions is one of the key parameters governing non-explosive to explosive magma fragmentation and eruption transitions, but remains poorly constrained. Combining results from laboratory experiments with realistic eruptive temperatures of magma cooling in ambient water of variable temperatures, and numerical modeling of transient heat transfer, we find that magma-to-water heat flux can be up to 4×106 Wm−2. The experiments exhibit two distinct water boiling regimes: A film-boiling regime defined by the presence of a coherent water vapor film between magma surface and ambient water, and a nucleate boiling regime below a critical magma surface temperature (known as the Leidenfrost temperature), where the vapor film breaks and numerous bubbles form at the magma-water interface. In general the vapor film was stable in our experiments for time scales of ≤ 5 s, indicating that this might be a limiting factor in pre-explosion magma-water mixing for energetic molten fuel-coolant interaction and explosive volcanic eruptions. The time scale of vapor film stability increases and the Leidenfrost temperature (1223 to 948 K) decreases with increasing water temperature (276 to 366 K). We show that for the empirically obtained large heat flux to external water, the cooling rate of magma can reach up to 106 Ks−1 at length scales of few microns, thus magma may undergo fine fragmentation due to quench-induced large thermal stresses. Our experimental and modeling results demonstrate that the time scales of various water boiling regimes, and erupting magma and ambient water temperatures determine the magma-to-water heat transfer rates, which in turn determine the transition to explosivity under subaqueous eruption conditions.