A theoretical study of the alkylation reaction of toluene with methanol catalyzed by the acidic Mordenite (Si/Al = 23) is reported. Cluster DFT as well as periodical structure DFT calculations have been performed. Full reaction energy diagrams of the elementary reaction steps that lead to the formation of the three xylene isomers are given. The use of periodical structure calculations allows one to account for zeolite framework electrostatic contributions and steric constraints that take place in zeolitic catalysts. Especially the steric constraint energy contribution has a significant effect on the energies and bond formation paths. The activation energy barrier of p-xylene formation is found to be approximately 20 kJ/mol lower than the corresponding values for the formation of its isomers. Computed host-guest binding energies according to the DFT method need a correction due to the absence of the dispersive interaction with the zeolite wall. Apparent activation energies obtained with this correction are in good agreement with experimental data.