b2KIT

Geohash Encoder / Decoder

Encode coordinates to geohash strings and decode geohashes to bounding boxes on a map.

Tested tool guide Tested browser tools Checked August 16, 2026

What Geohash Encoder / Decoder does, with a checked example

Enter a latitude, longitude, and character precision to obtain a geohash, or supply a geohash to recover its geographic bounds and view the cell on a map. The format repeatedly narrows longitude and latitude ranges, then represents the resulting decisions with a compact base32 string. A geohash does not preserve one exact point. It identifies a rectangular cell containing that point, so decoding returns an area, with its midpoint sometimes shown as a representative coordinate.

Worked example

A concrete input and expected output from the current implementation.

Input

Latitude: 42.6
Longitude: -5.6
Precision: 5

Expected output

ezs42

At five-character precision, the coordinate lies in the cell encoded as ezs42. Decoding that string identifies the cell containing the entered point, not the exact original decimals.

How the result is produced

1

Encoding coordinates

Geohash encoding repeatedly divides the longitude and latitude ranges into halves, beginning with longitude and interleaving the resulting decisions. Each group of five decisions becomes one character from the geohash base32 alphabet: 0123456789bcdefghjkmnpqrstuvwxyz. The selected precision is the number of output characters, and additional characters identify progressively smaller cells.

2

Decoding a cell

Decoding expands each character into five subdivision decisions and applies them to the latitude and longitude intervals. The intervals remaining after the final bit are the cell's south, north, west, and east bounds. Their midpoints can represent the cell center, but every coordinate inside the same bounds has the same geohash at that precision.

Good uses

  • Convert a GPS coordinate into the fixed-length geohash expected by a location index, database field, cache key, or data exchange format.
  • Decode an unfamiliar geohash from a log or dataset to see the rectangular area it denotes and inspect that area on a map.
  • Test how different precision lengths affect approximate spatial grouping before choosing a geohash length for records, map features, or nearby-place searches.

Limits and checks

  • Confirm coordinate order before encoding. Latitude is normally entered first and ranges from -90 to 90, while longitude ranges from -180 to 180. Swapped values may remain numerically valid but describe a different place.
  • Do not interpret a decoded center as the original coordinate. A fixed-length geohash discards position detail within its cell, and that lost detail cannot be recovered from the string.
  • Shared prefixes indicate shared containing cells, but proximity does not guarantee a shared prefix. Two points separated by a cell boundary can have different prefixes even when they are physically close.

Common questions

Can decoding a geohash recover the exact coordinate that was encoded?

No. At any finite precision, many coordinates encode to the same string. Decoding recovers the latitude and longitude intervals for that cell, and the midpoint may be reported for convenience. The original point could have been anywhere within those bounds. Retain the source coordinates separately if their exact values must remain available.

How many geohash characters should I use?

Choose the length according to the geographic uncertainty your application can accept and any format required by the receiving system. More characters produce a smaller cell, while fewer characters describe a broader region. Cell dimensions are not a single constant worldwide: east-west ground width changes with latitude, and successive characters divide the two dimensions unevenly.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools