The document presents a novel approach using grey wolf optimization (GWO) to determine the optimal energy management and sizing of battery storage for grid-connected microgrids. The objective is to minimize operational costs by considering the optimal battery size. GWO is implemented and shown to outperform other algorithms like genetic algorithm, particle swarm optimization, bat algorithm, and improved bat algorithm in terms of solution quality and computational efficiency. Numerical results demonstrate that GWO reduces microgrid operational costs by 33.185% compared to other algorithms through smart utilization of battery energy storage.