This paper proposes a genetic algorithm-based method for sizing the energy storage system (ESS) in microgrids. The main goal of the proposed method is to find the energy and power capacities of the storage system that minimizes the operating cost of the microgrid. The energy management strategy (EMS) used in this paper is based on a fuzzy expert system which is responsible for setting the power output of the ESS. The design of the EMS is carried out by means of a genetic algorithm that is used to set the fuzzy rules and membership functions of the expert system. Given that the size of the storage system has a major influence on the energy management strategy, in this paper the EMS and ESS capacities are jointly optimized. In addition, the proposed method uses an aging model to predict the lifetime of the ESS. In this way it is possible to determine the cost associated with energy storage in a more precise manner. The unit commitment problem, which is crucial for the proper operation of the microgrid, has been also considered in the present work. The suggested sizing methodology has been validated in two case studies.