Abstract This paper presents a Unified Power Quality Conditioner (UPQC) with a 27- level inverter based on an asymmetric H-bridge topology. Each phase of the inverter is composed of three H-bridges, supplied by three DC sources scaled in the power of three. The output of the multilevel inverter is connected directly to the point of common coupling (PCC) without the need to a transformer or a filter. The calculation of the Shunt Active Power filter (SAPF) compensation current is based on the generalized theory of synchronous frame (d-q theory) while the calculation of a series active filter voltage is based on Instantaneous Reactive Power (p-q theory). The control of the SAPF is achieved by using a closed loop vector control followed by a new multilevel modulation technique. In addition to the capability of harmonic elimination of both current and voltage drawn from the source, the UPQC can produce real and reactive power to feed the loads during prolonged voltage outages or source shortage. The injection of real and reactive power depends on the state of charge (SOC) of batteries, the frequency of the system, real and reactive power of the load, and power factor at the point of PCC. The proposed UPQC strategy is simulated in MATLAB SIMULINK and the results has shown a significant improved in Total Harmonics Distortion (THD) of both the voltage and currents.