How to Use the GeoHash Encoder/Decoder
Switch between Encode and Decode at the top. In Encode mode, enter a latitude, longitude, and desired precision (1 to 12 characters), and the tool returns the corresponding GeoHash string. In Decode mode, paste a GeoHash and the tool returns the center coordinate of the cell along with the error margin, which tells you how big the bounding box is at that precision. The default example encodes New York City's coordinates at precision 9, which narrows the location down to an area about 5 meters across.
How GeoHashes Work Under the Hood
A GeoHash is produced by interleaving bits of the longitude and latitude after recursively halving the globe. Each step splits either the longitude range or the latitude range in half, records a 0 or 1 depending on which side the point falls, and continues until enough bits have been collected for the requested precision. The bit stream is then grouped into 5-bit chunks and encoded using a custom base-32 alphabet that excludes visually ambiguous characters. This produces a short string that is stable, deterministic, and that shares a prefix with neighboring locations — the property that makes GeoHashes useful for indexing and range queries.
When to Use GeoHashes in Your Application
GeoHashes shine in any system that needs compact geographic identifiers. Use them as cache keys for geospatial data so that nearby queries share a cache entry. Store them in database indexes for fast prefix-based range queries — all documents whose geohash starts with 'dr5r' fall into the same rough region. Use them as URL parameters to identify a place without exposing exact coordinates, which is useful for privacy. Use them as tile identifiers in custom map systems. And use them in distributed systems as deterministic sharding keys for geographic data partitioning.
Limitations to Keep in Mind
GeoHashes are not a perfect representation of nearness. Two points that are a few meters apart can fall on opposite sides of a cell boundary, producing geohashes that share only a short prefix. To avoid missing close neighbors, query the geohash of your point along with the eight neighboring cells. GeoHashes also distort at high latitudes because longitude cells shrink with the cosine of latitude — a precision-5 cell near the equator is much wider east-to-west than the same precision cell near the poles. And GeoHashes are tied to a rectangular lat/lon grid, which does not align well with administrative boundaries, so they are not a substitute for proper polygon-based geofencing.
Frequently Asked Questions
What is a GeoHash?
A short URL-safe string that encodes a latitude/longitude into a rectangular cell on the Earth. Longer strings mean smaller cells and higher precision.
Why use GeoHashes?
They are compact, human-readable, and enable prefix-based proximity queries in databases and caches without requiring full geospatial indexes.
How precise is each length?
Roughly: 5 chars ≈ 5 km, 7 chars ≈ 150 m, 9 chars ≈ 5 m, 12 chars ≈ 4 cm. Each additional character shrinks the cell by about 4–5×.
What characters can appear in a GeoHash?
The 32-character alphabet "0123456789bcdefghjkmnpqrstuvwxyz". The letters a, i, l, and o are excluded to avoid confusion with digits.
What happens at cell boundaries?
Neighbors on opposite sides of a cell edge can have very different geohashes. Query the point plus its eight neighbors for robust proximity search.
Save your results & get weekly tips
Get calculator tips, formula guides, and financial insights delivered weekly. Join 10,000+ readers.
No spam. Unsubscribe anytime.