Geohash Encoder & Decoder
Encode a coordinate to a geohash or decode one back to a cell.
Overview
The Geohash Encoder and Decoder converts between latitude/longitude coordinates and geohash strings. Drop in a coordinate and pick a precision; the tool returns the geohash. Paste in a geohash and the tool returns the centre coordinate of the cell along with its bounding box.
Geohash is a compact, hierarchical encoding popular in spatial databases, key-value stores and search engines. Two locations that share a prefix are close on Earth: 9q8yyk and 9q8yym are neighbours, while 9q8yyk and dr5ru are continents apart. That prefix-locality property makes geohashes ideal for proximity queries, sharding strategies, geocaching IDs and anywhere you need a string key that preserves spatial nearness.
How it works
Geohash divides the world into a grid using interleaved binary searches: each bit alternately halves the longitude range, then the latitude range. After collecting enough bits the result is base-32 encoded using a custom alphabet (0-9bcdefghjkmnpqrstuvwxyz - no a, i, l or o to avoid confusion). Each base-32 character contributes 5 bits, so an 8-character geohash carries 40 bits of precision.
Cell size shrinks geometrically with each added character. A length-1 geohash covers a chunk roughly 5,000 km wide. Length 5 narrows that to about 5 km. Length 8 reaches roughly 38 m, and length 12 - the practical maximum - is around 3.7 cm. The tool returns the geometric centre of the cell plus the south-west and north-east corners so you know the full extent.
Examples
- (51.5074, -0.1278) at precision 6 encodes to
gcpvj0- central London. - (40.7128, -74.0060) at precision 8 encodes to
dr5regw3- midtown Manhattan, cell about 38 m square. 9q8yykdecodes to centre (37.7777, -122.4170) - San Francisco, cell about 1.2 km square.udecodes to a vast slab covering most of Europe, length 1 cells are about 5000 km wide.
FAQ
Why are some letters missing from the alphabet?
Geohash uses base-32 with the letters a, i, l and o removed to make hand-typed values less error-prone. The alphabet is 0-9bcdefghjkmnpqrstuvwxyz.
How long should my geohash be?
Pick precision by cell size. 5 characters give roughly 5 km accuracy (good for cities), 7 gives roughly 150 m (good for neighbourhoods), 9 gives 5 m (good for street addresses). Going beyond 10 is rarely useful.
Do neighbouring geohashes always share a prefix?
Mostly, but not at grid boundaries. Two cells that sit either side of the equator, the prime meridian, or the antimeridian will have very different prefixes despite being adjacent on Earth.
Is geohash spherical or cartesian?
The algorithm halves latitude and longitude ranges independently. Cells are rectangular in lat/lng space, which means physical cell area shrinks near the poles.