Purpose - Due to the increase of the traffic, issues are appearing on DC-electrified railway feeding systems. One candidate solution to solve these issues and to improve their performances is to add storage systems in the railway DC electrical network. The purpose of this paper is to present a method based on an optimal power flow (OPF) for the analysis and design of DC railway feeding systems with storage. Design/methodology/approach - The paper describes a new methodology based on optimization to study DC-electrified railways, including storage systems. A load flow model of a DC 1,500 V railway electrification system is presented, including the mobility of the train sets. Then, an OPF model of the DC network, including energy storage systems and feeding substation rectifiers has been developed. Finally, the OPF model has been tested on a real application case showing its benefits while searching solutions in order to improve the network performances. Findings - An OPF model suitable for analysis of DC networks with storage is presented. It shows its ability to solve large scale problems. Research limitations/implications - The paper focusses on the physical model of the network. The optimization model will have to be extended with application constraints. Originality/value - The hypothesis presented in this paper allows to remove the discontinuities of the system in order to use a continuous optimization approach.