Battery storage has been widely used in renewable energy systems. Due to the high cost and limited life span of batteries, effective energy management is normally needed to optimize the battery usage. This paper proposes an online energy management (OEM) for a lithium-ion battery bank used in PV-based systems to meet the load demand. An electrical model and a capacity fade model of batteries, which have been experimentally calibrated, are combined and incorporated in the online energy management. By considering the different status of individual batteries in the battery bank, the proposed OEM aims to minimize the total capacity fade of the battery bank, as well as to economize the cost of using energy. The performance of the proposed OEM is tested and compared with a baseline method under three different scenarios using field-collected PV generation data, load demand data and the real-time uniform Singapore energy price. The proposed OEM shows significant advantages over the baseline method in terms of lower cost of using energy as well as smaller battery capacity fade.