Mass spectrometry is an analytical technique that measures the mass-to-charge ratio of ions to identify unknown compounds and determine molecular structure. It works by ionizing atom or molecules and then separating the resulting ions based on their mass-to-charge ratio to produce a mass spectrum. There are various ionization methods used including hard ionization techniques like electron impact that cause fragmentation and soft techniques like electrospray ionization and matrix-assisted laser desorption/ionization that produce little fragmentation. Mass spectrometry has wide applications in fields like environmental analysis, forensics, pharmaceutical analysis, and more.