DFT studies on the mechanism of the formation of "gemini" quaternary ammonium salts in the reaction of 1,4:3,6-dianhydro-D-mannitol ditriflate derivative with trimethylamine and its subsequent conversion to tertiary amine through the methyl-transfer reaction are discussed. Two alternative reaction pathways are presented in the gas phase and in ethanol. Additionally, the transformation of the monotriflate derivative of 1,4:3,6-dianhydro-D-mannitol into the single quaternary ammonium salt is presented. Two functionals (B3LYP, M062X) and two basis sets (6-31+G** and 6-311++G**) were used for the calculations. The effect of the substituent attached to the five-membered rings at the C2 (and/or C5) carbon atom on the activation barrier is described. The trimethylammonium group bond to the five-membered ring greatly reduces the activation barrier height. The preferred reaction pathway for the conversions was established. Including the London dispersion in the calculations increases the stabilization of all the points on the potential energy surface in relation to individual reactants.