This paper presents an innovative two degree-of-freedom (DoF) electromagnetic vibration energy harvester used in a railway environment and its optimization based on complete multi-physics modeling, coupling an analytical model, numerical magnetic flied simulations and experimental data used as input parameters. It highlights that the resonance frequencies of the harvester must not be equal to the predominant frequencies of the input signal, which differs greatly compared to the optimization of a one DoF device. Characteristic frequency hopping dependent on the mechanical quality factors linked to the two DoF is also observed. Two prototypes were designed and tested with real tram acceleration signals. An average electrical power of 6.5 mW was obtained experimentally with a prototype of 710 g and 141 cc, validating the multi-physics model and the optimization process.