System Designexplorer

Geohash cell explorer

A geohash turns a latitude and longitude into a short string. Longer strings name smaller cells, and a cell’s hash starts with the hash of the bigger cell around it. That makes “find things nearby” an ordinary prefix lookup in a database index.

Your point’s cell

Your point falls in cell u4pruy, which is about 654 m wide and 611 m tall.

Geohashu4pruy30 bits · 6 characters
North-westu4pruxNorthu4pruzNorth-eastu4prvpWestu4pruwThis cellu4pruyEastu4prvnSouth-westu4prutSouthu4pruvSouth-eastu4prvj
North is up. All nine cells have the same number of characters.
Cell size654 m × 611 mWidth × height at the cell’s centre
Cell centre57.648010, 10.409546Your point is inside this cell

Your point or geohash

Start from

Each character adds 5 bits and shrinks the cell.

Bounds of the cell and the geohash of each neighbour
ItemValue
Latitude range57.645264 to 57.650757
Longitude range10.404053 to 10.415039
Bits15 longitude + 15 latitude
North-west neighbouru4prux
North neighbouru4pruz
North-east neighbouru4prvp
West neighbouru4pruw
East neighbouru4prvn
South-west neighbouru4prut
South neighbouru4pruv
South-east neighbouru4prvj

Why one cell is not enough

Two points 1 m apart, either side of this cell’s east edge, get u4pruy and u4prvn. They share only 4 of 6 characters. A shared prefix means “inside the same cell”, but a different prefix does not mean “far away”.

For a nearby search, query this cell and its eight neighbours, then filter the results by real distance. That covers a point near any edge or corner, as long as the cell is larger than the search radius.

What it shows

Cells have edges. Two points a metre apart can land in different cells with different prefixes, so a nearby search has to check the cell and its neighbours, not just one cell.

Enter a point and a precision to see its geohash, the size and bounds of its cell, and the eight cells around it. Or paste a geohash to decode it back to a cell. An optional view shows how longitude and latitude bits are interleaved.

How to read it

  • The grid shows your cell in the middle and its eight neighbours, with north at the top.
  • A neighbour reads “none” past a pole. Neighbours across the 180th meridian wrap around.
  • Each character is 5 bits, so n characters give 5n bits. Longitude gets the first bit, then the two alternate.
  • Odd lengths make cells square in degrees; even lengths make them twice as wide as tall.
  • Cell size is computed on a sphere, so it is approximate. Width shrinks towards the poles; height stays almost the same.
  • “Why one cell is not enough” takes two points about a metre either side of the east edge and shows how little of their hashes they share.

Questions

How many characters should I use?

Pick a cell a little larger than your search radius, so a radius search needs at most the cell and its neighbours. For a 500 m radius that is about 6 characters at mid latitudes. Cell width depends on latitude, so check the table.

Why do nearby points sometimes have different prefixes?

Cells are fixed rectangles. A point just across an edge is in the next cell, and at the biggest splits, such as the equator or the prime meridian, even the first character differs. That is why searches include the neighbouring cells.

Why is geohash.org not linked?

The original geohash.org site now redirects elsewhere. The sources below are an archived copy of its announcement and tips page, the Wikipedia article and the Redis documentation.

Does a longer shared prefix always mean closer?

No. A longer shared prefix means a smaller shared cell, so the points are within that cell’s size of each other. The reverse fails: close points can share little or nothing.

How is this different from what Redis does?

Redis stores a 52-bit integer made the same way, longitude and latitude bits interleaved, 26 bits each. It reads it as a sorted-set score and searches the matching cell and its neighbours, then filters by distance.

Learn it properly

Sources

Explore further

  • H3Uber’s hexagonal grid, an alternative to geohash cells for spatial indexing.

Last updated

More tools

All tools

Your first senior-level
lesson is free.

Choose a course, open a free lesson, and explore an idea you’ve wanted to understand.