Energy management plays an important role in the safe, reliable and economical operation of microgrids. Energy management is responsible for scheduling and controlling the distributed generators, energy storage devices and controllable loads based on the operating conditions of the system. The optimal planning of microgrids is also crucial, which aims to obtain the best solution to system configuration (e.g. the types and capacities of the devices) according to energy demand and available distributed energy resources during the planning period, together with the specifi planning objectives and system constraints. Due to the need for an economic analysis of the devices during their life cycle, the selection of proper operational strategies for microgrids becomes an important component of optimal planning, which means that the operational strategies will greatly affect the fi planning solution. Energy management and optimal planning of microgrids are the focus of this chapter.