Electron density is a key parameter to characterize Martian ionospheric structure and dynamics. Based on the ephemeris and auxiliary information derived from the Spacecraft, Planet, Instruments, C-matrix, and Events (SPICE) toolkit, we calculated the bending angle of signal path from the frequency residuals measured by the Mars Express Radio Science Experiment (MaRS) of the Mars Express (MEX) mission under the assumption of a spherically symmetric ionosphere. We stratified the ionosphere into layers and assumed a linear change of bending angle between layers, to derive profiles in radial distance of refractivity with the optimized parameters of upper integral limit of 4890 km and baseline correction boundary of 3690 km. Meanwhile, we also compared the retrieved electron density profiles between the frequency residuals of the single-frequency and differential Doppler of the dual-frequency. In total, ~640 electron density profiles of Martian ionosphere between April 2004 and April 2015 were retrieved successfully. There are 24 profiles identified manually that exhibit an additional sporadic layer occurrence below the normal two-layers. We also found that the peak altitude of this layer increases with the main peak altitude.