Skip to content
ZeroServer.tools

Geohash Encoder / Decoder

Encode latitude/longitude coordinates into a compact geohash string, or decode a geohash back to coordinates.

Encode → Geohash

~±19 m

Geohash

gcpvj0du

Decode ← Geohash

About Geohash Encoder / Decoder

A geohash is a compact alphanumeric string that encodes a geographic coordinate into a hierarchical spatial index. It works by recursively bisecting the world into a grid and encoding the path taken to reach a cell. Longer strings mean smaller, more precise cells. Geohashes with the same prefix are geographically nearby, making them useful for proximity queries in databases. This tool implements the standard Geohash algorithm using base-32 encoding with the alphabet 0–9bcdefghjkmnpqrstuvwxyz.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Producing a short string that represents a location for use as a database key.
  • Grouping nearby points by comparing shared geohash prefixes.
  • Decoding a geohash from a log or an API back into coordinates.
  • Choosing a precision that matches the grid size your application needs.
  • Building a coarse spatial index without a geospatial database.

Frequently Asked Questions

How does a geohash encode a location?
By repeated bisection. The world is halved by longitude, then by latitude, alternating, and each choice contributes one bit — 1 for the upper half, 0 for the lower. Every five bits become one base-32 character, so an eight-character hash represents 40 successive bisections of the globe.
Why does the alphabet skip a, i, l and o?
To survive being read aloud and retyped. The base-32 set is `0123456789bcdefghjkmnpqrstuvwxyz` — the four omitted letters are the ones most easily confused with 1 and 0. Geohashes get dictated over radios and typed into search boxes, which is what the alphabet is designed for.
How precise is each length?
Roughly: 4 characters is about 20 km, 5 is 2.4 km, 6 is 610 m, 7 is 76 m, 8 is 19 m, 9 is about 2.4 m. Each extra character narrows the cell by a factor of about 5.7 on average, alternating between splitting longitude and splitting latitude.
Do nearby places always share a prefix?
Usually, and that is the point — a shared prefix means a shared cell, so a prefix query is a bounding-box query. But two points either side of a cell boundary can be metres apart with completely different first characters, which is why real proximity searches also check the eight neighbouring cells.
Why does decoding return a box rather than a point?
Because that is honestly what a geohash contains: the cell the coordinate fell into, not the coordinate. The point reported is the cell's centre, so decoding then re-encoding is stable while decoding never returns your exact input. The bounding box is the real answer, and it is shown.

Common errors and gotchas

  • Assuming a shared prefix always means proximity. Points either side of a cell boundary can be adjacent yet share nothing.
  • Reading a decoded geohash as an exact point, when it is a cell and carries an inherent error.
  • Choosing a precision far finer than the source coordinates justify, which implies accuracy you do not have.
  • Forgetting that cell dimensions are not square and vary with latitude.
  • Comparing geohashes lexicographically as a distance measure, which it is not.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate