Geohash Encoder & Decoder
Convert coordinates to a geohash and back, plus why cells alternate shape and why two points metres apart can share no prefix at all.
The eight neighbours are listed because a proximity search on prefixes alone misses everything across a cell boundary. Nothing is uploaded.
Cells alternate between square and twice as wide
Each character is five bits, alternating longitude and latitude, longitude first. At an odd length longitude has had one more bit than latitude — and since longitude spans 360 degrees against latitude's 180, that extra bit is exactly what squares the cell up. At an even length the bits are equal and the cell is twice as wide as it is tall.
| Characters | Bits lon / lat | Cell size | Aspect | At the equator |
|---|---|---|---|---|
| 1 | 3 / 2 | 45.000000° × 45.000000° | 1:1 | 5001.0 km × 5001.0 km |
| 2 | 5 / 5 | 11.250000° × 5.625000° | 2:1 | 1250.2 km × 625.1 km |
| 3 | 8 / 7 | 1.406250° × 1.406250° | 1:1 | 156.3 km × 156.3 km |
| 4 | 10 / 10 | 0.351563° × 0.175781° | 2:1 | 39.1 km × 19.5 km |
| 5 | 13 / 12 | 0.043945° × 0.043945° | 1:1 | 4.9 km × 4.9 km |
| 6 | 15 / 15 | 0.010986° × 0.005493° | 2:1 | 1.2 km × 610.5 m |
| 7 | 18 / 17 | 0.001373° × 0.001373° | 1:1 | 152.6 m × 152.6 m |
| 8 | 20 / 20 | 0.000343° × 0.000172° | 2:1 | 38.2 m × 19.1 m |
| 9 | 23 / 22 | 0.000043° × 0.000043° | 1:1 | 4.8 m × 4.8 m |
| 10 | 25 / 25 | 0.000011° × 0.000005° | 2:1 | 1.2 m × 0.6 m |
So precision does not improve smoothly. Every character multiplies the area by 32, but splits that unevenly between the axes — one gains eightfold and the other fourfold, alternating. Going from 6 characters to 7 shrinks the cell and squares it up; going from 7 to 8 shrinks it and flattens it again. Nine characters is about 4.8 m across at the equator, and narrower than that everywhere else, since longitude degrees shrink toward the poles.
Two adjacent points can share nothing at all
The prefix property is the whole reason geohashes are used for proximity search, and it holds in one direction only. Points with a long shared prefix really are close. Points that are close need not share anything.
| Two points | Geohashes | Shared prefix |
|---|---|---|
| 22 m apart, across the prime meridian | gcpuzzrcj u10hbp214 | 0 |
| 11 m apart, well inside a cell | gcpuvr295 gcpuvr29g | 8 |
Not one character in common, for two points you could shout across. The very first bit of longitude separates them, and every character after that is downstream of it. The same thing happens at every cell boundary — the meridian is only the most dramatic because it is the boundary the first bit draws.
Which is why a proximity search on prefixes alone silently misses results rather than failing loudly, and why the fix is to search the cell and its eight neighbours. The tool above lists them for exactly that reason.
Checked against the published examples
| Coordinates | Characters | Geohash |
|---|---|---|
| 42.6, -5.6 | 5 | ezs42 |
| 57.64911, 10.40744 | 11 | u4pruydqqvj |
| 0, 0 | 5 | s0000 |
| -25.382708, -49.265506 | 9 | 6gkzwgjzn |
| 90, 180 | 5 | zzzzz |
| -90, -180 | 5 | 00000 |
The corners of the world map to the extremes of the alphabet, which is a useful sanity check on any implementation. The alphabet itself drops a, i, l and o — the four characters that read ambiguously aloud or on a screen — which is why a geohash never contains them and why input using them is rejected rather than quietly corrected.
How to use
- Enter coordinates and a character count.
- Or paste a geohash to decode it.
- Read the cell size at that latitude.
- The eight neighbours are listed for proximity work.
Frequently asked questions
How precise is a geohash?
It depends on the length, and not smoothly. Five characters is about 4.9 km square at the equator, seven is 153 m, nine is 4.8 m. Every character multiplies the area by 32 but splits that unevenly between the axes, so the cell changes shape as well as size.
Why are geohash cells not square?
Because each character is five bits alternating between longitude and latitude, starting with longitude. At odd lengths longitude has had one more bit, which exactly compensates for it spanning 360 degrees against latitude’s 180, so the cell is square. At even lengths the bits are equal and the cell is twice as wide as tall.
Do nearby points always share a prefix?
No, and this is the trap. Two points 22 metres apart either side of the prime meridian encode to gcpuzzrcj and u10hbp214 — not one character in common, because the very first bit of longitude separates them. The implication runs one way only: a shared prefix means close, but close does not mean a shared prefix.
So how do I do proximity search properly?
Search the cell and its eight neighbours rather than the prefix alone. This page lists them for that reason. Prefix-only search does not fail loudly, it silently returns fewer results, which is the harder kind of bug to notice.
Why does the alphabet skip some letters?
Geohash base 32 leaves out a, i, l and o — the characters that read ambiguously aloud or against digits. So a geohash never contains them, and this tool rejects input using them rather than quietly correcting it.
Is a shorter geohash a prefix of a longer one?
Yes, always, for the same point. Truncating a geohash gives exactly the geohash of that point at lower precision, which is the property that makes prefix indexing work at all. It is checked here over 2,000 random points at every length.
Does cell size change with latitude?
The width does. A cell is a fixed number of degrees, and longitude degrees shrink toward the poles, so a nine-character cell is about 4.8 metres wide at the equator and much narrower in Iceland. The height stays the same everywhere.
Does this send anything anywhere?
No. Everything is computed in your browser, and nothing is uploaded.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.