Geohash Explained: Precision, Neighbours and Nearby Search
What a geohash is, how many characters you need, why neighbours matter for nearby searches, and how to encode, decode and cover an area in the browser.

Geohash Explained: Precision, Neighbours and Nearby Search
Store-finder pages, ride-hailing apps and delivery dashboards all ask the same question: what is near this point? A full spatial index answers it well, but many teams reach for something simpler first, the geohash. It turns a latitude and longitude into a short text key, so ordinary database indexes can do location work. This guide explains how geohashes behave in practice and walks through the free Geohash Encoder and Decoder.
A string that zooms in
Picture the world map cut into 32 rectangles, each labelled with one character. Pick the rectangle that holds your point, cut it into 32 again, and add a second character. Repeat. After seven characters you are looking at a patch of ground roughly the size of a city block; after nine, a few metres. Because each step only refines the previous one, a longer hash always starts with the shorter ones. That is why prefix queries work: every location whose hash begins with gcpuu sits inside the same cell.
The alphabet uses digits and lowercase letters but skips a, i, l and o, which look too much like digits. If a hash contains one of those, it was mistyped.
Choosing a precision
The right length depends on the search radius, not on how precise your GPS is. A rough guide at mid latitudes:
- 5 characters: a few kilometres, good for "which district"
- 6 characters: around a kilometre wide, good for neighbourhood feeds
- 7 characters: about 150 m tall, good for "within a few hundred metres"
- 8 or 9 characters: tens of metres down to a few metres, good for deduplicating points
Cells get narrower as you move away from the equator, because lines of longitude converge. At London's latitude a seven-character cell is about 95 m wide but still 153 m tall. The precision table in the tool recalculates widths for whatever latitude you enter, which avoids nasty surprises in northern cities.
The neighbour problem
Here is the trap almost everyone falls into once. Two cafés stand on opposite sides of a street. One is in cell gcpuuz8, the other in gcpuuz9. A query for "same prefix as me" finds only one of them. Even worse, at cell corners and along the 180th meridian, nearby points may share almost no prefix at all.
The standard fix is to search the cell plus its eight neighbours. That 3 by 3 block is always at least one full cell in every direction around the point, so anything within one cell width is guaranteed to be found. Afterwards you filter the candidates by real distance. The tool shows the neighbour grid as tappable buttons and draws all nine cells on the map, so you can see exactly what area your query covers. A copy button gives the nine hashes as a comma-separated list for an IN clause.
Decoding is a box, not a point
Decoding a hash gives back a rectangle. The tool shows the centre, the south-west and north-east corners and the error margin. If you store only the hash, the original position is lost to within that margin, so keep the real coordinates in a separate column whenever accuracy matters, and use the hash just as the search key.
Working with files
The bulk tab is handy for data cleaning. Paste a CSV with latitude and longitude columns, or a list of hashes from a log or export, and download a table with both forms. A header row is detected and skipped, and lines that cannot be read are listed with the reason, which makes it quick to spot swapped columns or stray text.
Covering an area
Sometimes the question is not "near a point" but "inside this rectangle", for example all sensors in a project area. The cover tab lists every cell of a chosen precision that touches a bounding box. Use a coarse precision for big areas so the list stays short; the tool stops at 1,500 cells and suggests going coarser when needed. The map overlays the cells on the box so you can see how much extra ground the cover includes.
The map and privacy
The map is drawn from public-domain Natural Earth outlines that ship with the page. There are no calls to tile services, so it works offline and leaks nothing about the places you inspect. Coastlines are simplified, which is fine for checking cells and boxes but not for navigation.
Limits to keep in mind
Geohashes are a convenience, not a geodesic tool. Cells differ in area by latitude, distances between hash centres are approximations, and polygon search needs more than prefixes. For heavy spatial workloads, a proper spatial index such as PostGIS or an R-tree remains the better choice. For quick prototypes, caches and simple "nearby" features, a geohash with its neighbours does the job well.



