Planetary migration is a major challenge for planet formation theories . The speed of Type I migration is proportional to the mass of a protoplanet , while the final decade of growth of a pebble-accreting planetary core takes place at a rate that scales with the mass to the two-thirds power . This results in planetary growth tracks ( i.e. , the evolution of a protoplanet ’ s mass versus its distance from the star ) that become increasingly horizontal ( migration-dominated ) with rising mass of the protoplanet . It has been shown recently that the migration torque on a protoplanet is reduced proportional to the relative height of the gas gap carved by the growing planet . Here we show from 1-D simulations of planet-disc interaction that the mass at which a planet carves a 50 % gap is approximately 2.3 times the pebble isolation mass . Our measurements of the pebble isolation mass from 1-D simulations match published 3-D results relatively well , except at very low viscosities ( \alpha < 10 ^ { -3 } ) where the 3-D pebble isolation mass is significantly higher , possibly due to gap edge instabilities that are not captured in 1-D . The pebble isolation mass demarks the transition from pebble accretion to gas accretion . Gas accretion to form gas-giant planets therefore takes place over a few astronomical units of migration after reaching first the pebble isolation mass and , shortly after , the 50 % gap mass . Our results demonstrate how planetary growth can outperform migration , both during core accretion and during gas accretion , even when the Stokes number of the pebbles is small , { St } \sim 0.01 , and the pebble-to-gas flux ratio in the protoplanetary disc is in the nominal range of 0.01 – 0.02 . We find that planetary growth is very rapid in the first million years of the protoplanetary disc and that the probability for forming gas-giant planets increases with the initial size of the protoplanetary disc and with decreasing turbulent diffusion .