Explained

The DIGIPIN algorithm, explained in plain English.

No code, no jargon. Just an honest walk through how 10 characters can pin down a 4-metre square anywhere in India.

Start with a map of India

Picture the entire territory of India enclosed by a single rectangle on a map — a bounding box that goes from the westernmost tip of Gujarat to the easternmost edge of Arunachal, and from the southernmost point of Tamil Nadu to the northernmost point of Ladakh. That rectangle is where the DIGIPIN algorithm begins.

Step 1 — Divide the rectangle into a grid

The algorithm divides that big rectangle into a small grid — typically a 4 × 4 grid, giving 16 cells. Each cell is assigned a unique character from the DIGIPIN alphabet (more on that alphabet in a moment). The cell containing your location is identified, and its character becomes the first character of your DIGIPIN.

Step 2 — Zoom in and repeat

Now zoom into just the cell you landed in, ignoring the other 15. Divide that smaller rectangle into another 4 × 4 grid. Find which cell of those 16 contains your location. Its character becomes the second character of your DIGIPIN.

Step 3 — Keep zooming

Do the same thing eight more times. Each zoom level adds one more character to your DIGIPIN and shrinks the cell by a factor of four in each direction (16× in area). After 10 zooms, the cell you're inside is roughly 4 m on each side — about the area of a small room.

That's the entire algorithm. Ten zooms = ten characters = one 4 m × 4 m grid square.

Ad slot — paste your AdSense unit here

The alphabet

DIGIPIN uses a carefully chosen alphabet — a subset of letters and digits picked to avoid visual confusion. Characters like O and 0, or I and 1, are not both used, because they look too similar when handwritten or printed in a low-resolution font. The exact alphabet is part of India Post's published standard.

The hyphens you see in a DIGIPIN like 4FK-9L8-J2T7 are just for readability. They aren't part of the data; the actual code is the 10 characters 4FK9L8J2T7.

Why a hierarchical grid (and not just latitude/longitude)?

Latitude and longitude are precise — typically 16 to 20 characters with decimals — but they have downsides as a consumer-facing address:

  • They're long. "17.385044, 78.486671" is awkward on a parcel label.
  • They're easy to mis-type. A wrong decimal point sends you across the planet.
  • They aren't truncatable. Dropping a character gives you a different point, not a nearby one.

A hierarchical grid solves all three: DIGIPINs are short, the alphabet is non-ambiguous, and similar locations have similar codes. Two DIGIPINs that share their first 8 characters are inside the same 64 m × 64 m square — useful for clustering and for de-duplication.

Encoding and decoding

The algorithm is symmetric:

  • Encode (location → DIGIPIN). Given a latitude and longitude, repeatedly divide the bounding box, picking the right cell at each level, and concatenate the characters.
  • Decode (DIGIPIN → location). Given a DIGIPIN, walk through each character, narrowing the bounding box at each step. After 10 characters you have a 4 m × 4 m square. The centre of that square is the "decoded" location.

Both operations are deterministic and run in milliseconds. Anyone can run them offline once they have the algorithm.

Why 4 metres?

A 4 m × 4 m square is roughly the footprint of a typical doorway with the area immediately in front of it. It's small enough to be useful — usually identifying a single doorstep — but large enough that GPS accuracy under normal conditions (5–10 m) usually lands you in the right cell or an adjacent one. Going smaller would have meant longer codes for diminishing real-world benefit. Going larger would have meant ambiguity within dense urban blocks.

Ad slot — paste your AdSense unit here

What about the edges of the grid?

Two real edge cases worth knowing:

  • Boundary nudge. If your true location sits almost exactly on the boundary between two cells, small GPS errors can flip you to the neighbour. In practice, both DIGIPINs point at essentially the same spot — but they're different strings.
  • National boundary. The DIGIPIN grid covers the territory of India. Locations outside India aren't encoded — that's by design.

Properties worth knowing

  • Unique. Every 4 m square has exactly one DIGIPIN.
  • Reversible. Given the DIGIPIN, anyone can compute the exact grid square.
  • Hierarchical. Truncating from the right zooms out: first 9 chars give a 16 m square, first 8 give 64 m, and so on.
  • Stable. The DIGIPIN of a location doesn't change as long as the location and the algorithm don't.
  • Open. The specification is published so anyone can implement it.

Where to go next