Mass spectrometry is a technique used to determine the molecular mass and elemental composition of compounds. It works by ionizing molecules using electron bombardment, which causes the molecules to fragment into ions of various m/z ratios. The ions are then separated by mass analyzers based on their m/z and detected. This provides information about the molecular mass and structure of the compound being analyzed. Mass spectrometry can analyze solids, liquids, and gases.