The excessive dispersion measure (DM) of fast radio bursts (FRBs) has been proposed to be a powerful tool to study intergalactic medium (IGM) and to perform cosmography. One issue is that the fraction of baryons in the IGM, $f_{rm IGM}$, is not properly constrained. Here we propose a method of estimating $f_{rm IGM}$ using a putative sample of FRBs with the measurements of both DM and luminosity distance $d_{rm L}$. The latter can be obtained if the FRB is associated with a distance indicator (e.g. a gamma-ray burst or a gravitational wave event), or the redshift $z$ of the FRB is measured and $d_{rm L}$ at the corresponding $z$ is available from other distance indicators (e.g. type Ia supernovae) at the same redshift. Since $d_{rm L}/{rm DM}$ essentially does not depend on cosmological parameters, our method can determine $f_{rm IGM}$ independent of cosmological parameters. We parameterize $f_{rm IGM}$ as a function of redshift and model the DM contribution from a host galaxy as a function of star formation rate. Assuming $f_{rm IGM}$ has a mild evolution with redshift with a functional form and by means of Monte Carlo simulations, we show that an unbiased and cosmology-independent estimate of the present value of $f_{rm IGM}$ with a $sim 12%$ uncertainty can be obtained with 50 joint measurements of $d_{rm L}$ and DM. In addition, such a method can also lead to a measurement of the mean value of DM contributed from the local host galaxy.