Optimal Power Flow (OPF) is one of the most effective tools used for the accurate analysis of power systems. This paper describes OPF based on Particle Swarm Optimization (PSO) method in which total generation cost function is considered as the objective function. The proposed OPF formulation contains detailed generator constraints including active and reactive power generation limits and also valve point loading effects. PSO developed in MATLAB is examined and tested on the standard IEEE 14 and 30 bus test systems. The simulation results are compared to those reported in the literature. The results demonstrate that the PSO algorithm developed within the scope of this study provides lower-cost results than the studies that are present in the literature.