What is Geohash?

Geohash is a geocoding system that encodes geographic coordinates (latitude and longitude) into a short string of letters and digits. It was invented by Gustavo Niemeyer in 2008 and provides a hierarchical spatial data structure that divides the world into a grid of cells.

Quick Facts

Full NameGeohash Geocoding System
Created2008 by Gustavo Niemeyer
SpecificationOfficial Specification

How Geohash Works

Geohash works by interleaving the binary representations of latitude and longitude, then encoding the result using Base32. Each character in a geohash represents a progressively smaller area, with longer strings providing greater precision. Adjacent locations often share similar prefixes, making geohashes useful for proximity searches and spatial indexing. The system is widely used in databases, caching systems, and location-based services for efficient geographic queries.

Key Characteristics

  • Encodes lat/lng into alphanumeric string (Base32)
  • Hierarchical structure - longer strings = more precision
  • Adjacent locations share common prefixes
  • Each character adds ~5 bits of precision
  • 12-character geohash has ~3.7cm precision
  • Publicly available algorithm with no licensing restrictions

Common Use Cases

  1. Spatial database indexing and queries
  2. Location-based caching and search
  3. Proximity detection and nearby searches
  4. URL-friendly location encoding
  5. Distributed systems with location sharding

Example

Geohash Examples:

Location: New York City (40.7128, -74.0060)
Geohash: dr5ru7 (6 chars, ~1.2km precision)

Precision by length:
1 char  = ~5,000 km
2 chars = ~1,250 km
3 chars = ~156 km
4 chars = ~39 km
5 chars = ~4.9 km
6 chars = ~1.2 km
7 chars = ~153 m
8 chars = ~38 m
9 chars = ~4.8 m

Adjacent cells share prefixes:
dr5ru7 and dr5ru6 are neighbors

Related Tools on QubitTool

Related Concepts