The railway power conditioner (RPC) is a promising technology to improve the regenerative braking energy (RBE) utilization and power quality of the traction power supply system (TPSS). The hybrid energy storage systems (HESS) play a key role in the economic operation of TPSS due to the high cost of the system. The capacity and power of HESS are the critical issues affecting the system performance and cost. Therefore, a hierarchical energy management model is proposed to optimize the HESS sizing and the scheduling of TPSS with RPC. At the master level, a nonlinear mathematical model is built to minimize the HESS cost, which includes capital cost, replacement cost, and recovery cost. At the slave level, considering voltage unbalance as a constraint, a mixed‐integer linear programming model is established to minimize the electricity cost of railway operation. In order to solve the hierarchical nonlinear programming problem, an improved particle Swarm optimization (PSO) algorithm with a GUROBI solver embedded is proposed. Finally, the results show that the 14.08% cost reduction is achieved, and the standard limit value of voltage unbalance is satisfied.