We formulate the Oldroyd-B model for viscoelastic fluids in terms of magnetic-like fields obeying a set of equations analogous to Maxwell’s equations. In the limit of infinite relaxation time for the polymer, the polymeric stress tensor can be identified with the Maxwell stress tensor of a magnetic field. Away from this asymptotic case, the stress tensor of the polymer cannot be decomposed in terms of a tensor product of a magnetic field any more and several theoretical issues arise. We show that the analogy between the Oldroyd-B model and Maxwell’s equations can still be rigorously extended provided that one defines three magnetic-like fields obeying Maxwell’s equations with magnetic currents and charges. This solves the theoretical caveats and leads to a better understanding of the viscoelastic instability. In particular, we evidence a gauge symmetry which unifies some previous works, and we investigate several gauge choices. As an illustration we apply our method to viscoelastic Taylor–Couette flow but this theory of ‘viscoelastic fields’ is general and may be useful in a large variety of viscoelastic flows. The present study may also be of interest from the electromagnetic point of view, as it provides real systems possessing magnetic-like charges (monopoles) and currents.