Effect of magnetic field has been studied for the electron-impact ion sources coupled with a quadrupole mass spectrometer. Computer simulation of electron trajectories showed better collimation and more helical rotations under stronger magnetic field, suggesting enhanced ionization efficiency. However, the magnetic field showed different effect on the mass spectrometer signals for different types of ion sources. For the cross beam ion source, where ion beam direction is perpendicular to the magnetic field, the mass spectrometer signals decreased when the magnetic field strength was higher than 20G. For the axial ion source, where both the electron beam and ion beam are on the same axis of the magnetic field, the mass spectrometer signals increased almost linearly with the applied magnetic field intensity. The axial ion source with a magnet intensity of 800G showed about five times improvement in mass spectrometer sensitivity compared with the cross beam ion source.