The development of a reliable power filter is essential for meeting the need for high-quality power. Current and voltage harmonics are a major contributor to poor power quality and must be eliminated. Shunt active power filters (SAPFs) can be installed to reduce the negative effects of harmonics. Fuzzy logic and proportional integral (PI) controllers excel at regulating DC link voltage in shunt active power filters (SAPFs). This research assessed how well Particle Swarm Optimization controls the DC link voltage in a Shunt Active Power Filter (SAPF), thereby mitigating harmonics. The appropriate PI control parameters are first determined using the Particle Swarm Optimization technique. The PSO-tuned PI parameters are combined with a fuzzy logic controller for the SAPF simulation. It has been demonstrated in simulations that a Shunt Active Power Filter (SAPF) with reference currents are generated in accordance with the instantaneous real and reactive power (p-q) theory, employing fuzzy and PSO -PI controller for diode rectifier type non-linear load. It is extremely effective for harmonic correction in distribution networks. The simulation work is carried out using MATLAB-SIMULINK.