This paper presents a methodology for the optimal allocation and economic analysis of energy storage system (ESS) in microgrids (MGs) on the basis of net present value (NPV). As the performance of an MG strongly depends on the allocation and arrangement of its ESS, optimal allocation methods and economic operation strategies of the ESS devices are required for the MG. To optimize the operation strategies and capacities of ESS in MGs, the financial benefit and dynamic models of ESS are discussed. And then, a matrix real-coded genetic algorithm is applied to find maximal NPV, in which each GA chromosome consists of a 2-D real number matrix representing the generation schedule of ESS and distributed generation sources. This paper is to suggest, among those available ESS, the optimal sizes and types of them and their optimal arrangement, such that the total NPV achieved during the system operational lifetime period is maximized. Finally, some computational simulation results are presented to verify the effectiveness of the proposed method.