Abstract In this work, the molecular structures and the thermal decomposition of nitromethane (NM) encapsulated inside armchair (5, 5), (6, 6), and (8, 8) single-walled carbon nanotubes were investigated on the basis of the ONIOM calculations in order to understand the effect of CNT encapsulation on the energetic compound. The results show that the NM encapsulated inside CNT(5, 5) has a different geometry with respect to the isolated NM. The molecular structure of NM is not evidently affected by the encapsulation of CNT(6, 6) and CNT(8, 8). The activation energy barriers of the C–N thermal decomposition for the NM encapsulated inside CNT(5, 5) are found to be lower of about ∼17 kcal/mol than the C–N bond dissociation energy of the isolated NM, indicating that the CNT(5, 5) can promote the C–N thermal decomposition of encapsulated NM. In the cases of CNT(6, 6) and CNT(8, 8), the energy barriers to be overcome for the C–N bond thermal decomposition are very similar to the value of the isolated NM. The effect of encapsulation energy and CNT polarizability are expected to be responsible for the variation of the C–N dissociation activation energy for the NM encapsulated inside CNT with different diameter.