W-matrix is applied for the mixed analysis of variance model to compute maximum likelihood estimates of the fixed parameters and variance components. An efficient algorithm is developed in this paper for the W-matrix in the sense of storage economy and computing time. The efficiency of the algorithm is demonstrated through examples which are given.