The device is based on the local compensation of the magnetic field fluctuations created by catenary current fluctuations. The device is comprised of a magnetic field sensor which resupplies the compensator circuit to suppress the field in the sensor within a period of time which is shorter than the characteristic time of the fluctuation so that the field is suppressed at any time. The invention relates to a device capable of compensating, originally, the perturbations of the magnetic field in the vicinity of an electric railway line, said perturbations being caused by the catenary power supply variations.