The stored and wasted explosives are usually in an acid or alkali environment, leading to the importance of exploring the acid and alkali effects on the decomposition mechanism of explosives. The acid and alkali effects on the decomposition of HMX molecule in gaseous state and in aqueous solution at 298 K are studied using quantum chemistry and molecular force field calculations. The results show that both H(+) and OH(-) make the decomposition in gaseous state energetically favorable. However, the effect of H(+) is much different from that of OH(-) in aqueous solution: OH(-) can accelerate the decomposition but H(+) cannot. The difference is mainly caused by the large aqueous solvation energy difference between H(+) and OH(-). The results confirm that the dissociation of HMX is energetically favored only in the base solutions, in good agreement with previous HMX base hydrolysis experimental observations. The different acid and alkali effects on the HMX decomposition are dominated by the large aqueous solvation energy difference between H(+) and OH(-).