Abstract-Repetitive control (RC) scheme presents an attractive solution to achieve excellent steady-state tracking error and low total harmonic distortion (THD) for periodic signals. RC can produce extremely large gains at fundamental and each harmonic frequency of reference signal to achieve all harmonics suppression. However, a DC-AC inverter always has uneven THD distribution, e.g. THD concentrates at 4k ± 1 orders for signal-phase inverter, and 6k ± 1 orders for three-phase inverter. Furthermore, a digital RC requires a integral ratio of the sampling frequency and the reference frequency, whereas the digital control system cannot always meet this requirement. For example, (e.g. 60 Hz reference signal with a 5 kHz sampling frequency, or grid-connected converter under grid frequency fluctuation, etc.). In this paper, virtual delay unit (VDU) based digital nk ± m-order harmonic RC is presented to solve the problems above. The VDU produces a different virtual RC sampling frequency from the system sampling frequency. The virtual sampling frequency for digital RC can be flexibly adjusted based on the integral ratio requirement. The advantage of VDU is that it does not vary the system sampling frequency and it is easy to be realized. Furthermore, nk ± m-order harmonic repetitive controller is selected to provide a selective harmonic compensation (SHC). Experimental results of VDU based nk±m-order harmonic RC for 60 Hz single-phase DC/AC inverter with 5 kHz system sampling frequency are provided to show the effectiveness of the proposed VDU-based SHC.