Electronic charges introduced in copper-oxide planes generate high-transition temperature superconductivity but, under special circumstances, they can also order into filaments called stripes. Whether an underlying tendency of charges to order is present in all cuprates and whether this has any relationship with superconductivity are, however, two highly controversial issues. In order to uncover underlying electronic orders, magnetic fields strong enough to destabilise superconductivity can be used. Such experiments, including quantum oscillations in YBa2Cu3Oy (a notoriously clean cuprate where charge order is not observed) have suggested that superconductivity competes with spin, rather than charge, order. Here, using nuclear magnetic resonance, we demonstrate that high magnetic fields actually induce charge order, without spin order, in the CuO2 planes of YBa2Cu3Oy. The observed static, unidirectional, modulation of the charge density breaks translational symmetry, thus explaining quantum oscillation results, and we argue that it is most likely the same 4a-periodic modulation as in stripe-ordered cuprates. The discovery that it develops only when superconductivity fades away and near the same 1/8th hole doping as in La2-xBaxCuO4 suggests that charge order, although visibly pinned by CuO chains in YBa2Cu3Oy, is an intrinsic propensity of the superconducting planes of high Tc cuprates.