This paper presents the design and simulation of a single-phase shunt active power filter for harmonic and power factor compensation of multiple nonlinear loads. The system is modeled in Matlab Simulink to consist of an uncontrolled rectifier and an AC controller as the nonlinear loads, with an active filter to compensate for the harmonic current injected by the load. The active filter is based on a full-bridge single-phase inverter. The design of the active filter controller is based on time-domain method that consists of three main tasks; to identify the harmonic content and form a synchronized reference, to provide closed-loop control to force the current of the active filter to follow the reference and to regulate the capacitor DC voltage. The spectral analysis of the supply current shows the harmonics produced by the load has been successfully compensated by the active filter. The effect of varying the switching frequency on the performance of the active filter is also presented.