Knowledge of spatiotemporal distribution and likelihood of (re)occurrence of salt-affected soils is crucial to our understanding of land degradation and for planning effective remediation strategies in face of future climatic uncertainties. However, conventional methods used for tracking the variability of soil salinity/sodicity are extensively localized, making predictions on a global scale difficult. Here, we employ machine-learning techniques and a comprehensive set of climatic, topographic, soil, and remote sensing data to develop models capable of making predictions of soil salinity (expressed as electrical conductivity of saturated soil extract) and sodicity (measured as soil exchangeable sodium percentage) at different longitudes, latitudes, soil depths, and time periods. Using these predictive models, we provide a global-scale quantitative and gridded dataset characterizing different spatiotemporal facets of soil salinity and sodicity variability over the past four decades at a ∼1-km resolution. Analysis of this dataset reveals that a soil area of 11.73 Mkm2 located in nonfrigid zones has been salt-affected with a frequency of reoccurrence in at least three-fourths of the years between 1980 and 2018, with 0.16 Mkm2 of this area being croplands. Although the net changes in soil salinity/sodicity and the total area of salt-affected soils have been geographically highly variable, the continents with the highest salt-affected areas are Asia (particularly China, Kazakhstan, and Iran), Africa, and Australia. The proposed method can also be applied for quantifying the spatiotemporal variability of other dynamic soil properties, such as soil nutrients, organic carbon content, and pH. Significance Land degradation due to soil salinization has detrimental impacts on vegetation, crops, and human livelihoods, leading to a need for a methodologically consistent analysis of the variability of different aspects of salt-affected soils. However, previous studies on the soil salinity issue have been primarily spatial and localized, leaving the large-scale spatiotemporal variations of soil salinity widely ignored. To address this gap, we present a globally validated analysis quantifying the long-term variations (40 y) of topsoil salinity at high spatial resolutions using machine-learning techniques. The results have significant implications for agroecological modelling, land assessment, crop growth simulation, and sustainable water management.