Evidence is mounting that charge order competes with superconductivity in high T c cuprates. Whether this has any relationship to the pairing mechanism is unknown as neither the universality of the competition nor its microscopic nature has been established. Here, we show using nuclear magnetic resonance that charge order in YBa 2 Cu 3 O y has maximum strength inside the superconducting dome, similar to compounds of the La 2 À x (Sr,Ba) x CuO 4 family. In YBa 2 Cu 3 O y , this occurs at doping levels of p ¼ 0.11-0.12. We further show that the overlap of halos of incipient charge order around vortex cores, similar to those visualised in Bi 2 Sr 2 CaCu 2 O 8 þ d , can explain the threshold magnetic field at which long-range charge order emerges. These results reveal universal features of a competition in which charge order and superconductivity appear as joint instabilities of the same normal state, whose relative balance can be field-tuned in the vortex state.