The invention discloses a comparator for measuring alternating current and direct current. The comparator includes a sensing head, a modulation transformer, a DC side standard resistor, an AC side standard resistor, a band pass filter, a synchronous demodulator, a DC power amplifier, an AC voltage amplifier, and an AC power amplifier; the measuring head includes three units having the same structure; each unit includes a ring detection iron core, a detection winding, an electrostatic shielding layer, a magnetic shielding iron core and a secondary winding; the first and second units, the modulation transformer, the band pass filter, the synchronous demodulator, the DC power amplifier and the DC side standard resistor constitute a DC detection system based on the double iron core magnetic modulator principle; the third unit, the AC side standard resistor, the AC voltage amplifier and the AC power amplifier constitute a single core based AC detection system. The comparator can measure DCand AC current, can also measure a DC component and an AC component of a mixed current formed by superposition of the DC current and the AC current.