Abstract To assure the security, heavy monitoring and maintenance procedures for the fatigue of rails are set up by infrastructure managers. In order to go towards a more cost efficient railway system, it is essential to optimize the maintenance of rails: frequency of monitoring, rail replacement strategy, grinding policy To progress in this area, a numerical modeling tool has been developed thanks to a long-term collaboration between railway organizations (SNCF, RFF, RATP), rail producer (Tata Steel) and research institutes and universities (INRETS, LMS, MECAMIX, INSA) within the IDR2 consortium (Initiative for Development and for Research on Rail). This modelling starts with a dynamical simulation of the vehicle rolling on a track, from which the cyclic mechanical state of the rail is calculated by means of a 3D finite element simulation and an original and time-cost efficient direct stationary algorithm. Finally, a fatigue analysis of the rail is performed with the Dang Van criterion. The modeling tool has been recently completed with the simulation of the crack propagation in the rails. A two-scale frictional contact fatigue crack model developed within the X-FEM framework is used to solve the crack problem. Using this approach, contact and friction between the crack faces is taken into account in the simulation. Realistic residual stresses, coming from dedicated software developed by SNCF are introduced in the propagation simulation via projection of the asymptotic mechanical fields. 2D Crack growth is performed taking into account the residual stresses. The results highlight their influence on the crack growth rate. Finally 3D preliminary results are introduced.