Salts in the root zone have high spatial variability, changes rapidly and adversely affects soil quality and crop productivity. Rapid detection of electrical conductivity (EC) using visible-near infrared (Vis-NIR) and midinfrared (MIR) spectroscopy can alleviate the adverse effects on soil and plant, which through conventional method is time consuming. Soils were collected from the Indo-Gangetic plains and analyzed for EC using conventional, Vis-NIR, MIR spectroscopy and there was wide variation in EC measured by the conventional method. The spectral regions in 460-500 and 1890-1906 nm in the Vis-NIR region and 4200-4310, 5275-5280, 6660-6670, 7305-7310 and 8290-8300 nm in the MIR region were sensitive to detection of EC. Partial least square regression (PLSR) outperformed random forest regression (RF), support vector regression (SVR), and multivariate adaptive regression splines (MARS) both in Vis-NIR and MIR region during calibration. The ratio of performance deviation (RPD), coefficient of determination (R2) and root mean square error (RMSE) of the validation dataset were used to assess the prediction accuracy and the predictive performance of PLSR (2.44, 0.84, 0.21), RF (1.95, 0.81, 0.20), SVR (2.09, 0.78, 0.22) and MARS (1.81, 0.73, 0.27) models. PLSR model performed very well in the Vis-NIR range; however, in the MIR range, RF (1.43, 0.52, 0.20), followed by PLSR (1.40, 0.55, 0.35), performed better than SVR (1.39, 0.53, 0.35) and MARS (1.29, 0.44, 0.37). Vis-NIR spectroscopy with PLSR algorithm predicted EC better than MIR spectroscopy and would be the method of choice for rapid estimation and prediction of EC in the study region.