Abstract Ammonium nitrate (AN) is considered to be a very hazardous and difficult to handle component of mineral fertilizers. Differential thermal analysis coupled with thermogravimetry and mass spectrometry was used to determine the possible inhibiting effect of selected magnesium compounds on thermal decomposition of AN. Each additive was mixed with AN to create samples with AN:magnesium compound mass ratios of 4:1, 9:1 and 49:1. Most of analyzed compounds enhanced thermal stability of ammonium nitrate, increasing the temperature of the beginning of exothermic decomposition and decreasing the amount of generated heat. Magnesium chloride hexahydrate was determined to accelerate the decomposition of AN while magnesium sulphate, sulphate heptahydrate, nitrate hexahydrate together with magnesite and dolomite minerals were defined as inhibiting agents.