Context. Fast radio bursts (FRBs) are poised to become important cosmological tools in the near future, as the number of observed FRBs is increasing rapidly with multiple surveys underway. A large sample of FRBs will soon have available dispersion measures (DMs) and rotation measures (RMs), which can be used to study the cosmic baryon density and the intergalactic magnetic field. However, the observed DM and RM of FRBs consists of multiple contributions that must be quantified to estimate the DM and RM of the intergalactic medium (IGM). Aims. In this paper, we estimate one such contribution to DM and RM, namely, of FRB host galaxies. We show how this contribution changes with redshift, galaxy type, and the stellar mass of the galaxies. We also investigate its dependence on galaxy inclination and on an FRB’s offset from the center of the galaxy. Methods. Using the TNG50 simulation of the IllustrisTNG project, we selected 16 500 galaxies at redshifts of 0≤ ɀ ≤2, with stellar masses in the range of 9 ≤ log(M*/M⊙) ≤ 12. In each galaxy, we calculated the DM and RM contributions of 1000 sightlines; from these, we constructed the DM and RM probability density functions (PDFs). Results. We find that the rest frame DM distributions of all galaxies at a given redshift can be fitted by a log normal function and its median and width increase as a function of redshift. The rest-frame RM distribution is symmetric, with a median RMhost,rf=0 rad m–2 and it can be fitted by a combination of a Lorentzian and two Gaussian functions. The redshift evolution of the distribution width can be fitted by a curved power law. The parameters of these functions change for different subsets of galaxies with different stellar mass, inclination, and FRB offset. These changes are due to an increasing ne with redshift, SFR, and stellar mass. We do find a more ordered B field at lower ɀ compared to higher ɀ, as suggested by the presence of more galaxies with B field reversals and B fields dominated by random B field at higher ɀ. Conclusions. We estimated the FRB host DM and RM contributions, which can be used in the future to isolate the IGM contribution from the observed DM and RM of FRBs. We predict that to constrain a σRM,IGM of 2 rad m–2 to the 95% confidence level, we would need to observe 95 000 FRBs at ɀ = 0.5, but only 9 500 FRBs at ɀ = 2.