A delivery rider is standing in the right lane, looking at the wrong house. "Near the temple, second gate, blue door" is how many Indian addresses actually work. A 6-digit PIN code narrows things down to a post office area, not to a doorstep.
DIGIPIN is India Post's answer: a code for a small square of land rather than for a building. It complements PIN codes rather than replacing them.
The scale
A DIGIPIN has 10 characters, and each character is one of 16 symbols.
That is 16^10 = 4^20, about 1.1 trillion possible cells (more than 1 lakh crore).
The last cell is roughly 4 m x 4 m. In our own re-implementation, a cell near 28° N works out to about 3.8 m north-south by 3.4 m east-west.
India Post has published the code as open source (Apache 2.0) on GitHub.
How a code is built, step by step
1. Start with one big box. The bounding box covers latitude 2.5° to 38.5° and longitude 63.5° to 99.5°: all of India and the sea around it, 36 degrees by 36 degrees.
2. Cut it into a 4 x 4 grid. Sixteen cells, each labelled with one of the sixteen symbols.
3. Find the cell your point is in, write down its symbol, and zoom into that cell.
4. Repeat ten times. Every level cuts the current cell into 16 again, so each side shrinks four times. After the tenth level, you are left with a cell about 4 metres across.
India Post's own example: the point 13.11179621, 80.20264269 in Chennai becomes 4T396F42L7. Our re-implementation, written from the published description, produces the same code.
Decoding is the same walk in reverse. Read the ten characters, zoom ten times, and return the centre of the last cell.
Why it works offline
There is no table of codes anywhere. DIGIPIN is a pure function: the same latitude and longitude always give the same code, on any phone, with no server call. Nothing has to be looked up, so nothing has to be online.
The property engineers care about: shared prefixes
Codes that start the same are close to each other, because every shared character means the two points sat in the same cell at that level. In our tests:
points about 20 m apart shared 7 characters,
about 120 m apart shared 6,
about 1.2 km apart shared 4.
That makes the code string itself a location index. An ordinary B-tree index on the code column turns "everything in this area" into a prefix range scan (WHERE digipin LIKE '4T3%').
The catch: borders
The prefix rule is one-way. Shared prefix means close; close does not always mean shared prefix. Two points 1 metre apart on either side of a cell border can share only the first few characters. In our test, a pair 1 m apart across a border shared just 3 (4T396867T7 and 4T38KFKJLJ).
The standard fix, used with geohash too: when you search for nearby points, check the point's own cell and its 8 neighbours, not just the one cell.
The interview answer
If you are asked to design "find nearby" for deliveries, drivers or stores, the DIGIPIN idea is the answer in one breath: divide space into a hierarchical grid, give every level one character, use a shared prefix as "nearby", and always check the neighbouring cells at borders.
Sources
India Post, github.com/INDIAPOST-gov/digipin: README (open-source geo-coded addressing, about 4 m x 4 m units, 10 characters, offline and online, Apache 2.0, the Chennai example) and src/digipin.js (bounding box, 4 x 4 grid, 16 symbols, 10 levels). Read 31 October 2026.
Cell sizes, prefix distances and the border pair were computed by Revquix with its own re-implementation of the published algorithm, which reproduces India Post's example code.
DIGIPIN explained: a 10-character address for every 4 metres
A delivery rider is standing in the right lane, looking at the wrong house. "Near the temple, second gate, blue door" is how many Indian addresses actually work. A 6-digit PIN code narrows things down to a post office area, not to a doorstep.
DIGIPIN is India Post's answer: a code for a small square of land rather than for a building. It complements PIN codes rather than replacing them.
The scale
A DIGIPIN has 10 characters, and each character is one of 16 symbols.
That is 16^10 = 4^20, about 1.1 trillion possible cells (more than 1 lakh crore).
The last cell is roughly 4 m x 4 m. In our own re-implementation, a cell near 28° N works out to about 3.8 m north-south by 3.4 m east-west.
India Post has published the code as open source (Apache 2.0) on GitHub.
How a code is built, step by step
1. Start with one big box. The bounding box covers latitude 2.5° to 38.5° and longitude 63.5° to 99.5°: all of India and the sea around it, 36 degrees by 36 degrees.
2. Cut it into a 4 x 4 grid. Sixteen cells, each labelled with one of the sixteen symbols.
3. Find the cell your point is in, write down its symbol, and zoom into that cell.
4. Repeat ten times. Every level cuts the current cell into 16 again, so each side shrinks four times. After the tenth level, you are left with a cell about 4 metres across.
India Post's own example: the point 13.11179621, 80.20264269 in Chennai becomes 4T396F42L7. Our re-implementation, written from the published description, produces the same code.
Decoding is the same walk in reverse. Read the ten characters, zoom ten times, and return the centre of the last cell.
Why it works offline
There is no table of codes anywhere. DIGIPIN is a pure function: the same latitude and longitude always give the same code, on any phone, with no server call. Nothing has to be looked up, so nothing has to be online.
The property engineers care about: shared prefixes
Codes that start the same are close to each other, because every shared character means the two points sat in the same cell at that level. In our tests:
points about 20 m apart shared 7 characters,
about 120 m apart shared 6,
about 1.2 km apart shared 4.
That makes the code string itself a location index. An ordinary B-tree index on the code column turns "everything in this area" into a prefix range scan (
WHERE digipin LIKE '4T3%').The catch: borders
The prefix rule is one-way. Shared prefix means close; close does not always mean shared prefix. Two points 1 metre apart on either side of a cell border can share only the first few characters. In our test, a pair 1 m apart across a border shared just 3 (4T396867T7 and 4T38KFKJLJ).
The standard fix, used with geohash too: when you search for nearby points, check the point's own cell and its 8 neighbours, not just the one cell.
The interview answer
If you are asked to design "find nearby" for deliveries, drivers or stores, the DIGIPIN idea is the answer in one breath: divide space into a hierarchical grid, give every level one character, use a shared prefix as "nearby", and always check the neighbouring cells at borders.
Sources
India Post, github.com/INDIAPOST-gov/digipin: README (open-source geo-coded addressing, about 4 m x 4 m units, 10 characters, offline and online, Apache 2.0, the Chennai example) and src/digipin.js (bounding box, 4 x 4 grid, 16 symbols, 10 levels). Read 31 October 2026.
Cell sizes, prefix distances and the border pair were computed by Revquix with its own re-implementation of the published algorithm, which reproduces India Post's example code.
Practise system design interviews with working engineers on Revquix: www.revquix.com/marketplace
© 2026 Revquix. All rights reserved.
Learn with a mentor
Top-rated mentors on Revquix, ready for a 1:1 session.
- RPRohit PariharSoftware Development Engineer at Blue Yonder5.0
- SNSudhanshu NautiyalEngineering Lead at Revquix5.0
- SKSumit Kumar BeheraSenior Consultant at EYNew
Browse all mentorsKeep reading