A deep dive into the grid, code, and step-by-step logic behind India's geo-coded address revolution.
DIGIPIN (Digital Postal Index Number) is India's standardized, open-source, geo-coded addressing system, developed by the Department of Posts in collaboration with IIT Hyderabad, NRSC, and ISRO. It divides the country into uniform 4m x 4m grid cells, each assigned a unique 10-character alphanumeric code derived from latitude and longitude. DIGIPIN is strictly a function of location, ensuring privacy and offline usability, and is the foundation of India's National Addressing Grid.
The DIGIPIN system overlays a logical grid on the entire territory of India, using a bounding box from 63.5°E to 99.5°E longitude and 2.5°N to 38.5°N latitude (EPSG:4326). This grid is recursively divided into 16 regions at each level, with each cell at level 10 representing a 3.8m x 3.8m area. The grid aligns with Survey of India's toposheets and includes India's maritime EEZ, making it suitable for land and sea addresses.
Code Length | Grid Size (approx.) |
---|---|
1 | 1000 km |
2 | 250 km |
3 | 62.5 km |
4 | 15.6 km |
5 | 3.9 km |
6 | 1 km |
7 | 250 m |
8 | 60 m |
9 | 15 m |
10 | 3.8 m |
Each DIGIPIN is a 10-character code using 16 symbols: 2, 3, 4, 5, 6, 7, 8, 9, C, J, K, L, M, P, F, T. The code is built hierarchically: the bounding box is split into 16 regions (level 1), each further split into 16 subregions (level 2), and so on for 10 levels. Each character in the code identifies a subregion at that level, uniquely pinpointing a 4m x 4m cell anywhere in India.
const DIGIPIN_SYMBOLS = ["2", "3", "4", "5", "6", "7", "8", "9", "C", "J", "K", "L", "M", "P", "F", "T"];
This process is deterministic and reversible, ensuring every location in India has a unique, permanent DIGIPIN.
This allows you to convert any valid DIGIPIN back to its precise GPS coordinates.
function encodeDIGIPIN(lat, lon) {
const L = [
["F", "C", "9", "8"],
["J", "3", "2", "7"],
["K", "4", "5", "6"],
["L", "M", "P", "T"]
];
let vDIGIPIN = "";
let MinLat = 2.5, MaxLat = 38.5, MinLon = 63.5, MaxLon = 99.5;
let LatDivBy = 4, LonDivBy = 4;
if (lat < MinLat || lat > MaxLat || lon < MinLon || lon > MaxLon) return "";
for (let Lvl = 1; Lvl <= 10; Lvl++) {
let LatDivDeg = (MaxLat - MinLat) / LatDivBy;
let LonDivDeg = (MaxLon - MinLon) / LonDivBy;
let row = 0, column = 0;
let NextLvlMaxLat = MaxLat;
let NextLvlMinLat = MaxLat - LatDivDeg;
for (let x = 0; x < LatDivBy; x++) {
if (lat >= NextLvlMinLat && lat < NextLvlMaxLat) {
row = x;
break;
} else {
NextLvlMaxLat = NextLvlMinLat;
NextLvlMinLat = NextLvlMaxLat - LatDivDeg;
}
}
let NextLvlMinLon = MinLon;
let NextLvlMaxLon = MinLon + LonDivDeg;
for (let x = 0; x < LonDivBy; x++) {
if (lon >= NextLvlMinLon && lon < NextLvlMaxLon) {
column = x;
break;
} else if (NextLvlMinLon + LonDivDeg < MaxLon) {
NextLvlMinLon = NextLvlMaxLon;
NextLvlMaxLon = NextLvlMinLon + LonDivDeg;
} else {
column = x;
}
}
vDIGIPIN += L[row][column];
if (Lvl === 3 || Lvl === 6) vDIGIPIN += "-";
MinLat = NextLvlMinLat;
MaxLat = NextLvlMaxLat;
MinLon = NextLvlMinLon;
MaxLon = NextLvlMaxLon;
}
return vDIGIPIN;
}
function decodeDIGIPIN(vDigiPin) {
vDigiPin = vDigiPin.replace(/-/g, "");
if (vDigiPin.length !== 10) return null;
const L = [
["F", "C", "9", "8"],
["J", "3", "2", "7"],
["K", "4", "5", "6"],
["L", "M", "P", "T"]
];
let MinLat = 2.5, MaxLat = 38.5, MinLng = 63.5, MaxLng = 99.5;
let LatDivBy = 4, LngDivBy = 4;
let LatDivVal = 0, LngDivVal = 0;
let ri, ci, f;
let Lat1, Lat2, Lng1, Lng2;
for (let Lvl = 0; Lvl < 10; Lvl++) {
ri = -1; ci = -1; f = 0;
const digipinChar = vDigiPin.charAt(Lvl);
LatDivVal = (MaxLat - MinLat) / LatDivBy;
LngDivVal = (MaxLng - MinLng) / LngDivBy;
for (let r = 0; r < LatDivBy; r++) {
for (let c = 0; c < LngDivBy; c++) {
if (L[r][c] === digipinChar) {
ri = r; ci = c; f = 1; break;
}
}
if (f) break;
}
if (f === 0) return null;
Lat1 = MaxLat - LatDivVal * (ri + 1);
Lat2 = MaxLat - LatDivVal * ri;
Lng1 = MinLng + LngDivVal * ci;
Lng2 = MinLng + LngDivVal * (ci + 1);
MinLat = Lat1; MaxLat = Lat2;
MinLng = Lng1; MaxLng = Lng2;
}
const CLat = (Lat2 + Lat1) / 2;
const CLng = (Lng2 + Lng1) / 2;
return { lat: CLat, lon: CLng };
}
Let's encode the coordinates of Dak Bhawan (28.622788°N, 77.213033°E):
This process is illustrated in the official India Post technical document (see Figure 4).