Single-phase three-wire UPSs are widely applied to commercial applications for supplying the 110V/220V critical loads. For the on-line UPS containing the rectifier and inverter circuits with cascaded connection, it is better to connect together the neutral line of both circuits for safety reason. However, in some applications only two-wire input is available such that the neutral line of the three-wire output has to float. This may cause unbalanced DC-link capacitor voltages when two 110V loads are unbalanced if the split-capacitor topology is employed. Similarly, two 110V output voltages will be unbalanced in the bypass mode if the input voltage is two-wire. To solve these problems a rectifier-inverter topology with a N-leg switch connecting to the neutral line of the load is proposed in this paper to replace the conventional split-capacitors topology. As the input voltage is three-wire that the input and the load voltages have common neutral line, the control signal of the N-leg switch is zero aiming for only flowing the unbalanced load current. On the contrary, as the input voltage is two-wire the control signal of the N-leg turns to balance two 110V load voltages. With the proposed configuration not only two 110V output voltages are balanced, the input power factor is also maintained unity and the input current is balanced even under three-wire input voltage and unbalanced loads. In addition to model the five-legs rectifier-inverter, the detailed design of the controllers is provided. A 4KVA system is designed and implemented in this paper.