

Mass spectrometry accurately measures the mass of different molecules within a sample. and to do so,it turns the atoms into ions (electrically charged atoms with either too few or too many electrons). Then it separates the ions by passing them first through an electric field, then through a magnetic field, so they fan out into a spectrum. A computerized detector tallies the ions in different parts of the spectrum and you can use this information to figure out what kinds of atoms were originally in the sample.
So, in working of a mass-spectrometer, ionization is the first step.
