Remote sensing ยท Formula guide
NDWI Formula: Landsat 5, 8 and 9 Bands With Calculator
NDWI = (Green โ NIR) / (Green + NIR) for open water: Bands 3 and 5 on Landsat 8 and 9, Bands 2 and 4 on Landsat 5. The other NDWI, (NIR โ SWIR) / (NIR + SWIR), tracks water in leaves.

Key takeaways
- Open-water NDWI (McFeeters, 1996): (B3 โ B5) / (B3 + B5) on Landsat 8-9, (B2 โ B4) / (B2 + B4) on Landsat 5.
- Leaf-water NDWI (Gao, 1996), which USGS publishes as NDMI: (B5 โ B6) / (B5 + B6) on Landsat 8-9, (B4 โ B5) / (B4 + B5) on Landsat 5.
- Convert Collection 2 pixels first: DN ร 0.0000275 โ 0.2 (USGS). Skipping this turned a sample NDWI of โ0.21 into โ0.08.
- The guides cited here set water cut-offs at 0.3 and 0.5, and built-up land often reads 0 to 0.2 (Sentinel Hub), so test on your own scene.
In this article
The NDWI formula is (Green โ NIR) / (Green + NIR), the version McFeeters proposed in 1996 to map open water. On Landsat 8 and 9 that means (Band 3 โ Band 5) / (Band 3 + Band 5). On Landsat 5 it means (Band 2 โ Band 4) / (Band 2 + Band 4).
A second index, published by Gao the same year, also carries the name NDWI. It uses (NIR โ SWIR) / (NIR + SWIR) and tracks water in leaves, not lakes. This guide gives the band numbers for each satellite, a pixel calculator that handles the Landsat scale factor, and worked examples.
NDWI formula by satellite: the band table
Band numbers changed between Landsat generations, so the same formula uses different files. The table follows the USGS Landsat band designations and the Copernicus Sentinel-2 mission page.
| Satellite | Green | NIR | SWIR 1 | NDWI for open water | NDWI for leaf water (NDMI) |
|---|---|---|---|---|---|
| Landsat 4-5 TM | B2 | B4 | B5 | (B2 โ B4) / (B2 + B4) | (B4 โ B5) / (B4 + B5) |
| Landsat 7 ETM+ | B2 | B4 | B5 | (B2 โ B4) / (B2 + B4) | (B4 โ B5) / (B4 + B5) |
| Landsat 8-9 OLI | B3 | B5 | B6 | (B3 โ B5) / (B3 + B5) | (B5 โ B6) / (B5 + B6) |
| Sentinel-2 MSI | B3 | B8 | B11 | (B3 โ B8) / (B3 + B8) | (B8 โ B11) / (B8 + B11) |
A common slip is to reuse Landsat 8 numbers on a Landsat 5 scene. Band 3 on Landsat 5 is red and Band 5 is SWIR, so the result is not NDWI at all. Check the band table against your scene ID before you run anything. For crop water use, see our guide to NDWI, NDMI and evapotranspiration.
Two indices share one name
Much of the confusion around NDWI comes from two 1996 papers. Both chose the same name for different jobs. Sentinel Hub’s script library separates them for this reason: green and NIR for water bodies, NIR and SWIR for water in leaves.
McFeeters NDWI: open water
Water absorbs strongly in the near infrared, while it still reflects some green light. Green minus NIR therefore turns positive over water and negative over most plants. Use this version for ponds, reservoirs, flood extent and shoreline change.
Gao NDWI: water in plants
SWIR reflectance responds to the water held in a canopy. NIR responds to leaf structure and dry matter but not to water content. Combining the two removes much of the structural effect, which leaves a signal tied to canopy water. USGS publishes this ratio as NDMI, the Normalized Difference Moisture Index, and says it is used to determine vegetation water content. If your goal is irrigation or crop stress, this is the one to compute.
MNDWI: open water near buildings
Xu (2006) replaced NIR with SWIR to give MNDWI = (Green โ SWIR) / (Green + SWIR). The aim was better detection of open water. It matters because the green-NIR version is sensitive to built-up land and can overstate water, as Sentinel Hub notes. On Landsat 8 and 9 it reads (B3 โ B6) / (B3 + B6). On Landsat 5 it reads (B2 โ B5) / (B2 + B5).
โถ How NDWI helps monitor farm water content from space ยท 7:57
How Landsat 5, Landsat 8 and Landsat 9 differ
All three give 30 m pixels in these bands, so older and newer scenes can sit side by side. They are not identical, though.
Landsat 5
- Launched on 1 March 1984 and decommissioned on 5 June 2013, according to USGS.
- Its Thematic Mapper sensor failed in November 2011, so TM scenes for NDWI end there.
- Seven TM bands, on a 16-day repeat cycle.
Landsat 8
- Launched on 11 February 2013 with the OLI and TIRS sensors.
- OLI records 12-bit data, which gives 4,096 possible grey levels per pixel at the sensor.
- Nine spectral bands and two thermal bands, on a 16-day repeat cycle.
Landsat 9
- Launched on 27 September 2021, flying 8 days out of step with Landsat 8.
- Same band numbers as Landsat 8, so the NDWI formula for Landsat 9 is identical.
The OLI near-infrared band is much narrower than the TM one. It runs 0.85-0.88 ยตm against 0.76-0.90 ยตm. That means a long NDWI time series crossing from Landsat 5 to Landsat 8 may hold a small step that is a sensor change and not a change on the ground. Treat small shifts across that join with care.
Looking ahead, USGS expects Landsat 10 to launch in 2031 with 26 bands. The USGS table lists green as Band 4, broad NIR as Band 11 and SWIR 1 as Band 18, so scripts with fixed band numbers will need another update.
Chart
Where each NDWI band sits in the spectrum
Wavelength in nanometres, Landsat 4-5 TM vs Landsat 8-9 OLI
How to calculate NDWI step by step
- Choose the index. Open water: green and NIR. Crop or forest moisture: NIR and SWIR.
- Get surface reflectance. Download Landsat Collection 2 Level-2 products, which are already atmospherically corrected, so you do not need to correct them yourself.
- Convert the pixel values. Apply the scale factor below before you do any ratio.
- Mask clouds and shadow. Use the quality band that ships with the scene.
- Apply the formula. Use the bands from the table for your sensor.
- Set a threshold from your own scene. Compare results against places you know are water and not water.
- Map and compare. Use the same index, sensor family and season when you compare dates.
The scale factor that changes your answer
Collection 2 pixels are stored as whole numbers, not reflectance. USGS gives the conversion as DN ร 0.0000275 โ 0.2. Its own example turns a pixel value of 18,639 into a reflectance of 0.313.
The โ0.2 offset is why you cannot run the ratio on raw values. Take a green value of 11,000 and a NIR value of 13,000. On raw numbers, NDWI is โ2,000 / 24,000 = โ0.08. After conversion, green is 0.1025 and NIR is 0.1575, so NDWI is โ0.055 / 0.26 = โ0.21. That is a very different number from the same pixel.
NDWI needs no extra scaling step. A normalized difference of positive reflectances always falls between โ1 and +1. A value outside that range points to a fill pixel or a negative reflectance after conversion. Raw values are all positive, so they stay inside the range, and a result inside the range does not prove you converted.
Code for Landsat 8 and 9
In a raster calculator or Python, with arrays read from the Collection 2 Level-2 files, the logic is short: green = B3 ร 0.0000275 โ 0.2, then nir = B5 ร 0.0000275 โ 0.2, then ndwi = (green โ nir) / (green + nir). For Landsat 5, read B2 and B4 instead. Treat pixels with a value of 0 as fill, since USGS uses 0 as the fill value for this product.
Try the numbers for your own farm below.
Calculator
What is the NDWI of your Landsat pixel?
Enter the raw Collection 2 Level-2 values for one pixel.
- NDWI for leaf water / NDMI (NIR-SWIR): 0.05
- MNDWI (green-SWIR): 0.03
- NDWI on raw values, for comparison only: -0.01
Example values only, not a benchmark. Works for Landsat 4-9 Collection 2 surface reflectance. Fixed constants: scale factor 0.0000275 and offset โ0.2 (USGS). Landsat 8-9 bands: green B3, NIR B5, SWIR B6. Landsat 4-5 bands: green B2, NIR B4, SWIR B5.
What NDWI values mean
No single cut-off works everywhere. Published guides differ, so use these as starting points only.
| Green-NIR NDWI | Usual reading | Source |
|---|---|---|
| Above 0.5 | Usually water bodies | Sentinel Hub |
| 0.3 and above | Water, in a stricter variant meant to cut urban false alarms | McFeeters (2013), via the NDWI reference summary |
| 0 to 0.2 | Often built-up areas, so check before calling it water | Sentinel Hub |
| Below 0 | Usually no open water: bright bare surfaces, and often plants | NDWI reference summary |
The middle range is where errors happen. Built-up land can read above 0, and shallow water or mixed pixels can read lower than clear open water, so low positive values need checking. A 30 m Landsat pixel covers 900 mยฒ, so a farm pond or a narrow canal often shares a pixel with its bank. The NDWI reference summary lists the original papers behind each threshold if you need to check them.
Leaf-water NDWI (NDMI) reads differently. It compares a canopy with itself over time. A falling value on one field through a dry spell says more than any fixed number, and a field visit should confirm the cause.
Uses in farming, water and site work
- Irrigation checks. NIR-SWIR values over time can show uneven canopy moisture across a field, which supports farm water management and efficient water use.
- Drought watch. The NDWI reference summary suggests the Gao version for vegetation in drought-affected areas.
- Flood mapping. Green-NIR or green-SWIR versions outline flooded ground and changes in water level.
- Farm ponds and reservoirs. Compare surface area between dates, within the limits of the pixel size.
- Mine sites. Consultants can use the green-based versions to check tailings ponds, pit lakes and nearby water bodies across dated scenes.
- Forest and pasture. The NIR-SWIR version is also applied to pasture management and to live fuel moisture for fire risk.
โถ How satellite imagery is used in precision agriculture ยท 13:41
Limits to plan for
Clouds. Clouds and their shadows distort the ratio, so mask them first. A global analysis in PMC put the mean at 141.4 daytime surface observations from Landsat 8 and Sentinel-2A/B combined in 2018, but only 81.9 after weighting for cloud.
Chart
How often a place can be imaged
Days between passes; last bar is a modelled global median, the others are design figures
Revisit time. One Landsat satellite repeats every 16 days, so short events can fall between passes. Landsat 8 and 9 together give 8 days. Sentinel-2’s two-satellite setup gives 5 days at the equator, and the same PMC study reports a global median of 2.3 days with all four satellites modelled together.
Mixed land cover. Dense plants over shallow water can hide the water signal. Buildings can create a false one. MNDWI helps with the second problem.
Comparing sensors. Band widths differ, as the chart shows. Sentinel-2’s B8 is a wide band, and its B8A is the narrower one closer to Landsat 8’s NIR. Note which you used.
Chart
Band width of NIR and SWIR 1 by sensor
Nanometres; Sentinel-2A values
NDWI, NDVI and other indices together
NDWI is easier to read alongside other indices. NDVI shows green plant cover, while NIR-SWIR moisture shows canopy water. A field with stable NDVI and falling moisture is a different case from one where both drop. Farmonaut’s satellite monitoring shows vegetation and moisture maps for a drawn field through the season. These maps show change, not its cause, so scout before you act. Readers building their own tools can compare this with other agricultural applications.
โถ Tutorial: monitoring a farm with satellite crop indices in the Farmonaut web app ยท 8:43
FAQ
What is the NDWI formula?
For open water it is (Green โ NIR) / (Green + NIR), from McFeeters (1996). For water in plants it is (NIR โ SWIR) / (NIR + SWIR), from Gao (1996), now often called NDMI.
What is the NDWI formula for Landsat 8?
(B3 โ B5) / (B3 + B5) for open water. (B5 โ B6) / (B5 + B6) for leaf water. Convert to reflectance first when you use Collection 2 Level-2 data. Landsat 9 uses the same numbers.
What is the NDWI formula for Landsat 5?
(B2 โ B4) / (B2 + B4) for open water, and (B4 โ B5) / (B4 + B5) for leaf water.
What is a good NDWI value?
There is no universal good value. For open water, the guides cited here use 0.3 and 0.5. For crops, watch the trend on one field over time.
What is the difference between NDWI and MNDWI?
MNDWI swaps NIR for SWIR. Xu suggested it for better detection of open water, and it is often tried where built-up land confuses the green-NIR version.
Why are my NDWI values outside โ1 to +1?
Likely causes are fill pixels or a negative reflectance after conversion. Raw values stay inside the range, so they are not the cause. Mask fill and cloud pixels, and keep values within the USGS valid range of 7,273 to 43,636.
Related pages on our site: satellite monitoring app, satellite data API, API documentation, agricultural monitoring, agricultural land, agricultural management, regenerative agriculture, farm sector cooperation.
Farmonaut mineral detection
Map your mining site
Start at mining.farmonaut.com to map your site with satellite data.

Sources
- USGS, What are the band designations for the Landsat satellites?: usgs.gov
- USGS, How do I use a scale factor with Landsat Level-2 science products?: usgs.gov
- USGS, Landsat Normalized Difference Moisture Index: usgs.gov
- USGS, Landsat Collection 2 Level-2 Science Products: usgs.gov
- USGS, Landsat 5: usgs.gov
- USGS, Landsat 8: usgs.gov
- USGS, Landsat 9: usgs.gov
- USGS, Landsat 10: usgs.gov
- Copernicus SentiWiki, S2 Mission: sentiwiki.copernicus.eu
- Sentinel Hub custom scripts, NDWI: custom-scripts.sentinel-hub.com
- Sentinel Hub custom scripts, NDMI: custom-scripts.sentinel-hub.com
- Global Revisit Interval Analysis of Landsat-8/-9 and Sentinel-2A/-2B Data (PMC): ncbi.nlm.nih.gov
- Wikipedia, Normalized difference water index (reference list for Gao 1996, McFeeters 1996 and 2013, Xu 2006): en.wikipedia.org
Discussion
Questions, corrections or field experience? Share them below. First-time comments are reviewed before they appear, and your email is never published.
No comments yet. Be the first to add a question or your experience.




Exploration consultancy · South Africa · Gold
Licence holder · Niger · Gold
Licence holder · Nigeria · Gold + lithium
Client · Tanzania · Gold
Client · Somalia · Gold
Client · Oregon, USA · Gold
Client & affiliate partner · Ghana · Gold