Atmospheric pressure chemical ionizations (APCIs) of morphine, codeine, and thebaine were studied in a corona discharge ion source using ion mobility spectrometry (IMS) at temperature range of 100 C-200 C. Density functional theory (DFT) at the B3LYP/6-311++G(d,p) and M062X/6-311++G(d,p) levels of theory were used to interpret the experimental data. It was found that in the presence of H 3 O + as reactant ion (RI), ionization of morphine and codeine proceeds via both the protonation and carbocation formation, whereas thebaine participates only in protonation. Carbocation formation (fragmentation) was diminished with decrease in the temperature. At lower temperatures, proton-bound dimers of the compounds were also formed. Ammonia was used as a dopant to produce NH 4 + as an alternative RI. In the presence of NH 4 + , proton transfer from ammonium ion to morphine, codeine, and thebaine was the dominant mechanism of ionization. However, small amount of ammonium attachment was also observed. The theoretical calculations showed that nitrogen atom of the molecules is the most favorable proton acceptor site while the oxygen atoms participate in ammonium attachment. Furthermore, formation of the carbocations is because of the water elimination from the protonated forms of morphine and codeine.