The actual vapor density characterizing the alkali metal spin-exchange rate remains a compelling issue for spin-exchange optical pumping. Based on the deduced relationship between the Faraday rotation angle and the rubidium vapor number density using the electron dynamics theory, we report a measurement of the number density for rubidium vapor sealed inside a cell based on a Faraday modulator. The measurement relies on the optical rotation angle due to Rubidium vapor under a bias magnetic field (~0.08 T) produced by a samarium-cobalt magnet. A Faraday modulator with a lock-in amplifier is used to accurately measure the tiny optical rotation angle in a temperature range of 387~468 K. In addition, a synchronization verification is performed by the photoelastic modulator. The recurring data showed that the two methods are consistent with each other. Compared with the photoelastic modulator (PEM) method, the Faraday modulator detection system does not need to adjust the optical axis difference of 45° in the PEM detection system, thereby reducing the complexity of the experiment and the error caused by the alignment of the optical axis, which showed that the Faraday modulator detection method more advantageous in measuring the alkali metal density.