What geohashes are and why they need decoding
A geohash is a compact base-32 string that encodes a geographic location as a hierarchically nested cell. The longer the string, the smaller and more precise the cell it describes. Geohashes are widely used in databases and search engines because they let you find nearby locations using simple string prefix matching — a spatial property that B-tree indexes understand natively.
You typically encounter a geohash when a database or API returns stored location data in this format. Decoding turns it back into human-readable latitude and longitude coordinates, plus the bounding box that shows how precise the original encoding was.
How it works
Each character in a geohash maps to a 5-bit value using a specific base-32 alphabet (the digits 0–9 and the letters b, c, d, e, f, g, h, j, k, m, n, p, q, r, s, t, u, v, w, x, y, z — skipping a, i, l, and o to avoid visual confusion). The bits from all characters are read in sequence, alternating between refining longitude (odd bit positions, starting from the first) and latitude (even bit positions).
Starting from the full longitude range [−180, 180] and latitude range [−90, 90], each bit halves the relevant range:
- A
1bit selects the upper half of the current range - A
0bit selects the lower half
After all bits are consumed, the remaining longitude and latitude ranges form the bounding box of the cell. The center of that box is the single reported coordinate.
gbsuv7ztq -> center near 50.998, -1.499 (with a small bounding box)
Precision and cell sizes
The length of a geohash directly controls its precision:
| Characters | Example | Approximate cell size |
|---|---|---|
| 1 | g | ~5,000 km × 5,000 km |
| 3 | gcp | ~156 km × 156 km |
| 5 | gcpvj | ~4.9 km × 4.9 km |
| 7 | gcpvj0d | ~153 m × 153 m |
| 9 | gcpvj0duq | ~4.8 m × 4.8 m |
| 11 | gcpvj0duqk9 | ~15 cm × 15 cm |
The bounding box this tool returns tells you exactly how much spatial uncertainty is encoded in the string you are decoding. A short geohash carries significant uncertainty; a long one pins a location to metres.
Prefix matching and proximity search
The most useful property of geohashes for developers is that a shared prefix means shared geography. Two geohashes that start with the same characters represent cells that are neighbours or nested within each other. Most proximity searches work by generating the geohash of a center point at a given precision, listing the 8 neighbouring cells (the same prefix hash plus its 8 adjacent cells), and querying a database WHERE geohash LIKE ‘prefix%’. This tool helps you verify whether a stored geohash actually represents the location you expect, and to understand the precision level before writing a proximity query.
Common uses
- Debugging a spatial database: paste a stored geohash to verify it decodes to the right location and has the expected precision.
- Understanding storage trade-offs: shorter geohashes use less storage but encode a larger area; use this tool to see the bounding box at different lengths before choosing your precision.
- Converting API responses: some APIs return locations as geohashes; decode them here before passing coordinates to other tools or map libraries.