In this work we investigate the effect of an external magnetic field B on the shape of flux tubes in QCD by means of lattice simulations, performed with N f = 2 + 1 flavors of stout improved dynamical staggered quarks with physical masses. After having discussed some difficulties in the practical definition of the flux tube at B = 0, we show that these ambiguities do not affect the determination of the flux tube modifications induced by the magnetic field. Different results are obtained depending on the relative orientations of the flux tube and of the magnetic field: they confirm that the magnetic field acts as transverse confinement catalyser and longitudinal confinement inhibitor; moreover, the flux tube itself loses its axial symmetry when it is not directed along the magnetic background. * Electronic address: claudio.bonati@df.unipi.it † Electronic address: scali@uni-wuppertal.de ‡ Electronic address: massimo.delia@unipi.it § Electronic address: michele.mesiti@swansea.ac.uk ¶ Electronic address: fnegro@pi.infn.it * * Electronic address: andrea.rucci@pi.infn.it † † Electronic address: francesco.sanfilippo@roma3.infn.it