Authors:Madhusudhan et alAbstract:Atmospheric chemical abundances of giant planets lead to important constraints on planetary formation and migration. Recent studies have shown that giant planets that migrate through the protoplanetary disk can accrete substantial amounts of oxygen-rich solids, leading to super-solar metallicities in the envelope and solar or sub-solar C/O ratios. Pebble accretion has been demonstrated recently to play an important role in core accretion and to have growth rates that are consistent with planetary migration. The high pebble accretion rates allow planetary cores to start their growth beyond 10 AU and subsequently migrate to cold (>~ 1 AU) or hot (<~ 0.1 AU) orbits. In this work we investigate how the formation of giant planets via pebble accretion influences their atmospheric chemical compositions. We find that under the standard pebble accretion scenario, where the core is isolated from the envelope, the resulting metallicities (O/H and C/H ratios) are sub-solar, while the C/O ratios are super-solar. Planets that migrate through the disk to become hot Jupiters accrete substantial amounts of water vapour, but still acquire slightly sub-solar O/H and super-solar C/O of 0.7-0.8. The metallicity can be substantially sub-solar (~0.2-0.5x solar) and the C/O can even approach 1.0 if the planet accretes its envelope mostly beyond the CO2 ice line, i.e. cold Jupiters or hot Jupiters that form far out and migrate in by scattering. Allowing for core erosion yields significantly super-solar metallicities and solar or sub-solar C/O, which can also be achieved by other means, e.g. photoevaporation and late-stage planetesimal accretion.