Mass spectrometry involves ionizing molecule samples and then measuring their mass-to-charge ratios. The samples are bombarded with electrons to produce molecular ions, which then fragment into product ions. These ions are separated based on their mass-to-charge ratios and detected, producing a mass spectrum that shows the abundances of each ion. This spectrum provides structural information about the precursor molecule and can be used to identify unknown compounds. Mass spectrometry is widely applied across many scientific fields including pharmaceutical analysis, environmental testing, and forensics.