A mass spectrometer (or mass spectrograph) is a device to determine the masses of molecules. The general method is to send ionized molecules through a magnetic field that pushes them sideways and measures their trajectories, the heavier molecules being affected less and having straighter trajectories. Ratios of the counts of known molecules can be determined through measuring the number reaching two different areas. This practice is called mass spectrometry. The word spectrometer (or spectrograph) is used because the device's ability to measure molecules by mass is analogous to the measurement of visible light by wavelength.
Mass spectrometers are included in space probes, to analyze material from dust or associated with solar system planets, moons, comets, or asteroids, either gathered by a lander, or collected from flying through the body's atmosphere or plume residue.