We compute and investigate four types of imprint of a stochastic background of primordial magnetic fields (PMFs) on the cosmic microwave background (CMB) anisotropies: the impact of PMFs on the CMB temperature and polarization spectra, which is related to their contribution to cosmological perturbations; the effect on CMB polarization induced by Faraday rotation; the impact of PMFs on the ionization history; magnetically-induced non-Gaussianities and related non-zero bispectra; and the magnetically-induced breaking of statistical isotropy. We present constraints on the amplitude of PMFs that are derived from different Planck data products, depending on the specific effect that is being analysed. Overall, Planck data constrain the amplitude of PMFs to less than a few nanoGauss, with different bounds that depend on the considered model. In particular, individual limits coming from the analysis of the CMB angular power spectra, using the Planck likelihood, are B 1 Mpc < 4.4 nG (where B 1 Mpc is the comoving field amplitude at a scale of 1 Mpc) at 95% confidence level, assuming zero helicity. By considering the Planck likelihood, based only on parity-even angular power spectra, we obtain B 1 Mpc < 5.6 nG for a maximally helical field. For nearly scale-invariant PMFs we obtain B 1 Mpc < 2.0 nG and B 1 Mpc < 0.9 nG if the impact of PMFs on the ionization history of the Universe is included in the analysis. From the analysis of magnetically-induced non-Gaussianity, we obtain three different values, corresponding to three applied methods, all below 5 nG. The constraint from the magnetically-induced passive-tensor bispectrum is B 1 Mpc < 2.8 nG. A search for preferred directions in the magneticallyinduced passive bispectrum yields B 1 Mpc < 4.5 nG, whereas the compensated-scalar bispectrum gives B 1 Mpc < 3 nG. The analysis of the Faraday rotation of CMB polarization by PMFs uses the Planck power spectra in EE and BB at 70 GHz and gives B 1 Mpc < 1380 nG. In our final analysis, we consider the harmonic-space correlations produced by Alfvén waves, finding no significant evidence for the presence of these waves. Together, these results comprise a comprehensive set of constraints on possible PMFs with Planck data.