SPI Calculator: Standardized Precipitation Index from Monthly Rainfall

Paste a monthly rainfall series and get the SPI at 1 to 24 months using the standard McKee et al. (1993) gamma method, the drought category of every month, a list of drought events with duration and severity, and a multi-scale heatmap that shows how short dry spells grow into long droughts. Verified against a SciPy implementation.

SPI-1 to SPI-24Gamma fit per monthDrought eventsMulti-scale heatmapCSV + Python
By Bimal Ghimire (PhD researcher, precipitation remote sensing) · Runs in your browser; data never leaves your device.

Standardized Precipitation Index Calculator

Months must be consecutive. Missing months: NA. Use the same unit throughout (mm or inches).
Time scale (months)

What is the Standardized Precipitation Index?

The SPI answers one question: how unusual is the precipitation of the last k months, compared with the same months in other years? It is expressed in standard deviations, so an SPI of −2 means as dry as roughly the driest 2.3% of comparable periods, anywhere in the world. Developed by McKee, Doesken and Kleist (1993) at Colorado State University, it was adopted in the 2009 Lincoln Declaration and the WMO SPI User Guide (2012) as the reference index for meteorological drought.

Because it needs only precipitation, it can be computed for any rain gauge or for gridded products such as CHIRPS, ERA5-Land or GPM IMERG. For the theory, history and the comparison with SPEI, read our guide SPI and SPEI explained.

How the SPI is Calculated, Step by Step

  1. Accumulate. For time scale k, sum the current and previous k − 1 months: \(X_t=\sum_{j=0}^{k-1}P_{t-j}\).
  2. Group by calendar month. All the March values of SPI-3 (Jan–Mar totals) form one sample, all April values another, and so on. This removes the seasonal cycle.
  3. Fit a gamma distribution to the non-zero values of each sample, \(g(x)=\dfrac{x^{\alpha-1}e^{-x/\beta}}{\beta^\alpha\Gamma(\alpha)}\), using Thom's (1958) maximum-likelihood approximation: $$A=\ln\bar x-\frac{\sum\ln x}{n},\qquad \hat\alpha=\frac{1}{4A}\left(1+\sqrt{1+\frac{4A}{3}}\right),\qquad \hat\beta=\frac{\bar x}{\hat\alpha}$$
  4. Handle zeros. With q the fraction of zero totals, the cumulative probability is \(H(x)=q+(1-q)\,G(x)\).
  5. Transform to the standard normal: \(\text{SPI}=\Phi^{-1}\!\big(H(x)\big)\). This "equiprobability transformation" keeps the probability and changes only the scale.
Why not just use anomalies? Rainfall totals are skewed and bounded at zero, especially at short time scales and in dry climates. A −50 mm anomaly means very different things in the wet and dry season. Fitting a distribution per month and mapping it to the normal makes every month and every place comparable.

Choosing the SPI Time Scale

ScaleReflectsTypical use
SPI-1Short-term precipitation; close to percent of normalMeteorological drought, short dry spells
SPI-3Seasonal moistureSoil moisture, agricultural drought, crop stress
SPI-6Medium-term trendsSeasonal streamflow and reservoir inflow
SPI-9Inter-seasonal patternsTransition from agricultural to hydrological drought
SPI-12 to SPI-24Long-term deficitsStreamflow, reservoirs, groundwater, hydrological drought

SPI Drought and Wetness Categories

SPICategoryExpected frequency
≥ 2.0Extremely wet2.3%
1.5 to 1.99Very wet4.4%
1.0 to 1.49Moderately wet9.2%
−0.99 to 0.99Near normal68.2%
−1.0 to −1.49Moderately dry9.2%
−1.5 to −1.99Severely dry4.4%
≤ −2.0Extremely dry2.3%

Categories from McKee et al. (1993) and the WMO SPI User Guide (2012). Expected frequencies follow from the standard normal distribution.

Drought Duration, Severity and Intensity

McKee et al. (1993) define a drought event as a period in which the SPI is continuously negative and reaches −1.0 or less. The event starts when SPI first falls below zero and ends when it becomes positive again.

$$D = t_{end}-t_{start}+1,\qquad S=\sum_{t=t_{start}}^{t_{end}}|\text{SPI}_t|,\qquad I=\frac{S}{D}$$
D = duration (months), S = severity (also called magnitude), I = intensity. These three numbers are the basis of drought frequency analysis with copulas.

Limitations of the SPI

Record length

Fewer than ~30 years gives unstable gamma parameters; extreme SPI values become unreliable.

Precipitation only

Ignores evaporative demand. Under warming, use SPEI as well (see our SPI vs SPEI guide).

Dry seasons and arid climates

Months with many zero totals produce a bounded, discontinuous SPI. Very negative values cannot occur when the median is zero.

Calibration period and distribution

SPI depends on the reference period and the fitted distribution (gamma vs Pearson III). Report both so others can reproduce your numbers.

Related Tools and Guides

Frequently Asked Questions

What is the Standardized Precipitation Index (SPI)?

The SPI expresses accumulated precipitation over a chosen period (1 to 48 months) as the number of standard deviations above or below the long-term median for that time of year. It was developed by McKee, Doesken and Kleist (1993) and is recommended by the World Meteorological Organization as the reference meteorological drought index.

How is the SPI calculated?

Precipitation is summed over the chosen time scale (for SPI-3, the current and previous two months). For each calendar month separately, a gamma distribution is fitted to the long-term record of these sums, with a separate probability for zero totals. The cumulative probability of each value is then converted to the equivalent standard normal value, which is the SPI.

What do SPI values mean?

SPI of 0 is median precipitation. Values of −1.0 to −1.49 are moderately dry, −1.5 to −1.99 severely dry and −2.0 or less extremely dry. Positive values indicate wet conditions on the same scale. Because SPI is standardized, values from different climates can be compared.

How many years of data are needed for SPI?

The WMO SPI User Guide recommends at least 20–30 years of monthly data, with 50–60 years or more being optimal. Short records make the fitted gamma distribution and therefore the extreme SPI values unreliable.

What is the difference between SPI-3 and SPI-12?

SPI-3 compares the last three months of precipitation with the same three months in other years, so it reflects short- and medium-term moisture relevant to soil moisture and crops. SPI-12 compares the last 12 months and reflects long-term conditions that affect streamflow, reservoirs and groundwater.

What is the difference between SPI and SPEI?

SPI uses precipitation only. SPEI (Vicente-Serrano et al., 2010) uses precipitation minus potential evapotranspiration, so it also captures the effect of rising temperature on drought. SPEI is preferred when warming is important; SPI is simpler and needs only rainfall.

References

McKee, T. B., Doesken, N. J., & Kleist, J. (1993). The relationship of drought frequency and duration to time scales. Proceedings of the 8th Conference on Applied Climatology, American Meteorological Society, 179–184.

World Meteorological Organization (2012). Standardized Precipitation Index User Guide (M. Svoboda, M. Hayes and D. Wood). WMO-No. 1090, Geneva.

Thom, H. C. S. (1958). A note on the gamma distribution. Monthly Weather Review, 86(4), 117–122.

Edwards, D. C., & McKee, T. B. (1997). Characteristics of 20th century drought in the United States at multiple time scales. Climatology Report 97-2, Colorado State University.

Guttman, N. B. (1999). Accepting the standardized precipitation index: a calculation algorithm. Journal of the American Water Resources Association, 35(2), 311–322.

Vicente-Serrano, S. M., Beguería, S., & López-Moreno, J. I. (2010). A multiscalar drought index sensitive to global warming: the standardized precipitation evapotranspiration index. Journal of Climate, 23(7), 1696–1718.