This paper proposes a novel harmonic compensator for consumer electronic equipment that act as harmonic voltage sources in single-phase circuits, using the correlation function. The distribution transformer is equipped with an additional winding on the secondary side, and a single-phase voltage-source PWM inverter is connected to the added winding, acting as a shunt active filter. The leakage inductor on the secondary side winding behaves as though connected in series to the consumer electronic equipment. The shunt active filter can thus be used to compensate harmonic currents on the source side without an inductor series-connected to the harmonic voltage source. The basic principle of the proposed compensation method is discussed in detail. Digital computer simulation is implemented to verify the validity of the proposed compensation method. Experimental results demonstrate the novelty and excellent practicability of the proposed harmonic compensator with the proposed harmonic current detection method using the correlation function.