Recently, with the stringent environmental regulations and shortage fossil-fuel reserve, power generation based on renewable energy sources is seen as a promising solution for future generation systems. A combination of these sources with an optimized configuration can face the climate change obstacles, permit better reliability, and reduce the cost of the generated energy. This paper presents a proposed particle swarm optimization (PSO) algorithm for an optimized design of grid-dependent hybrid photovoltaic-wind energy systems. This algorithm uses the actual hourly data of wind speeds, solar radiation, temperature, and electricity demand in a certain location. The PSO algorithm is employed to obtain the minimum cost of the generated energy while matching the electricity supply with the local demand with particular reliability index. The algorithm has been tested by considering a real case study used the actual situation to supply the electricity demand from utility grid at electricity market prices to estimate how significant are the cost saving compared to the actual situation costs. Results showed that the proposed algorithm responds well to changes in the system parameters and variables while providing a reliable sizing solution.