<p>The mass spectrometer includes an ion source; a mass spectrometry part; a sample container; a heater for the sample container; a first gas tube connected to the sample container to introduce a gas into the sample container; and a second gas tube connected to the sample container to transfer a headspace gas of the sample container to the ion source, in which the ion source generates ions of the headspace gas and the mass spectrometry part performs mass spectrometry of the ions.</p>