Skip to content
uencoder

Geohash

Geohash encodes geographic coordinates (latitude and longitude) as a Base32 string, where shared string prefixes express spatial containment.

Purpose

It reduces two-dimensional coordinates to a one-dimensional string, convenient for indexing, caching, and prefix range queries.

Mechanism

Latitude and longitude are alternately binary-searched: each step compares against the interval midpoint to emit a 0 or 1, and the interleaved bit string is mapped 5 bits at a time onto the Base32 alphabet. Longer prefixes mean higher precision.

Use cases

  • Spatial indexing and range queries
  • Location cache keys
  • Short-link geocoding

Related tools

References