4-(4-Methoxyphenethyl)-3,5-dimethyl-4H-1,2,4-triazole (3) was synthesized from the reaction of ethyl N'-acetylacetohydrazonate (1) with 2-(4-methoxyphenyl)ethanamine (2). The structure of the title compound 3 has been inferred through IR, H-1/C-13 NMR, mass spectrometry, elemental analyses and combination of X-ray crystallography and theoretical methods. In addition to the molecular geometry from X-ray determination, the molecular geometry and vibrational frequencies of the title compound 3 in the ground state, were calculated using the density functional method (B3LYP) with the 6-31G(d) basis set. The calculated results show that the optimized geometry can well reproduce the crystal structure and the theoretical vibrational frequencies show good agreement with experimental values. The nonlinear optical properties are also addressed theoretically. The predicted nonlinear optical properties of 3 are greater than ones of urea. In addition, DFT calculations of molecular electrostatic potentials and frontier molecular orbitals of the title compound were carried out at the B3LYP/6-31G(d) level of theory. (c) 2012 Published by Elsevier B.V.