Walnut composition is directly related to maintenance of quality. Chemical analyses have been determined using traditional and laborious methods, which are time-consuming and generate chemical waste. This justifies the development of fast and accurate alternative methodologies to control the composition. Near-infrared (NIR) and mid-infrared (MIR) spectroscopy techniques associated with chemometric tools have been applied in the development of several analytical methodologies for agricultural products. The aim of this study is to develop and compare these two spectroscopic techniques to determine the parameters of quality, such as moisture, protein, lipid, mineral composition and fatty acid which is grown in Iran, totally 66 samples. Proteins and fats accounted for more than 70% of the walnut kernel weight. Among other healthful properties, consumption of all the studied cultivars would be potentially beneficial to health. It was used near-infrared and mid-infrared spectroscopy associated with multivariate calibration methods based on partial least squares (PLS) algorithm. The determination coefficient (R2) for moisture, protein, lipid content and fatty acid were 0.78, 0.76, 0.85 and 0.87 for NIR and 0.66, 0.91, 0.92 and 0.62 for MIR, respectively, having an RMSECV (root mean square error of cross-validation) < 2.09%. The results show that both infrared (NIR and MIR) techniques have predictive abilities.