In this paper, a Polymer Electrolyte Membrane (PEM) fuel cell power system including burner, steam reformer, heat exchanger, and water heater has been considered. A PEM fuel cell system is designed to meet the electrical, domestic hot water, heating, and cooling loads of a residential building located in Tehran. Operating conditions of the system with consideration of the electricity cost has been studied. The cost includes social cost of the environmental pollutants (e.g. CO2 , CO and NO). The results show that the maximum energy needs of the building can be met by 12 fuel cell stacks with nominal capacity of 8.5 kW. Annual average electricity cost of thissystem is equal to 0.39 US$/kWh and entropy generation of this system through a year is equal to 1004.54 GJ/K1 . It is also concluded that increase in ambient temperature from 1 °C to 40 °C increases the entropy generation by 5.73%, carbon monoxide by 14.56%, and nitrogen monoxide by 8.9%, but decreases carbon dioxide by 0.47%.