Based on the Seventh Data Release (DR7) quasar catalog from the Sloan Digital Sky Survey, we investigate the variability of optical quasars in W1, W2, W3 and W4 bands of the Wide-field Infrared Survey Explorer (WISE) and the Near-Earth Object Wide-field Infrared Survey Explorer (NEOWISE). Adopting the structure function (SF) method, we calculate the SF (δ t = 1 yr) which shows no obvious correlations with the bolometric luminosity, the black hole mass and the Eddington ratio. The ensemble SFs in W1 and W2 bands show that the SF slopes are steeper than those in previous studies which may be caused by different cadence and observational epoch number. We further investigate the relation of variability amplitude σm between mid-infrared band and optical band, but no obvious correlation is found. No correlation is found between W1–W2 and g – r color. We think that the mid-infrared emission of quasars may be smoothed out by the extended dust distribution, thus leading to no obvious correlation. For the radio-loud quasar sub-sample, we further analyze the relation between the variability amplitude in the mid-infrared band and the radio luminosity at 6 cm, but no obvious correlations are found, which indicate the mid-infrared emission contributed from the synchrotron radiation of the relativistic jet is very weak.