The primary reactions of the thermal decomposition of hydrazinium nitroformate (HNF) as well as ammonium nitroformate (ANF) were investigated theoretically using the G3 multilevel procedure. Calculations were performed for the reactions in the gas phase and in the melt using a simplified model of the latter. The influence of the melt on the reaction barriers was taken into account by calculation of the solvation free energies using a PCM model. In contrast with many other energetic salts, the ionic salt structures of the HNF and ANF were found to be minima on the PES. However, the most energetically favorable structures of the HNF and ANF in the gas phase are H-bonded complexes. In the melt, on the contrary, the ionic structure is lowest in free energy because of solvation effects. In both the gas phase and melt, the HNF decomposes preferably to nitroform and hydrazine. This fact agrees well with the experimentally observed absence of HNF among the gas-phase decomposition products. Thermolysis of HNF occurs mainly through the intermediacy of nitroform; computations do not support the suggestion that the aci-nitroform is an important intermediate of HNF thermolysis. The primary dissociation reactions of ANF resemble those of the HNF.