Forming planets around young stars Planets form in protoplanetary discs around young stars as dust and ice particles collide to form larger and larger bodies. I will present a coherent theory framework for the formation of planetary systems. Dust grows to pebbles by coagulation and deposition of volatile ices, but the continued growth to planetesimals is hampered by the poor sticking of mm-cm-sized pebbles. Planetesimals can nevertheless form by gravitational collapse of pebble clumps concentrated in the turbulent gas through the streaming instability. The subsequent growth initially occurs by planetesimal-planetesimal collisions, but the accretion rate of pebbles dominates the growth from 1000-km-sized protoplanets to form the solid cores of gas giants, ice giants and super-Earths. The high growth rates by pebble accretion allow planetary cores to start their growth in much more distant positions than their final orbits. The giant planets orbiting our Sun and other stars, including systems of wide-orbit exoplanets, can therefore be formed in consistency with planetary migration.