Geohash Encoder/Decoder

Convert coordinates to geohash and decode geohash to lat/long instantly. Free online geohash converter with interactive map visualization, precision control (1-12), and neighbor cell display. Perfect for developers and GIS professionals.

Loading...

What is Geohash? A Complete Guide to Geospatial Encoding

Geohash is a public domain geocoding system invented by Gustavo Niemeyer that encodes geographic coordinates into a compact alphanumeric string. Our free online Geohash Encoder & Decoder tool allows you to instantly convert latitude/longitude coordinates to geohash strings and vice versa, with real-time map visualization. Whether you're building location-based services, optimizing database queries for proximity searches, or working with GIS data, this tool provides the precision and visualization you need. Geohash is widely used by companies like Uber, MongoDB, and Redis for efficient spatial indexing.

How to Convert Lat/Long to Geohash (and Back)

  1. To encode coordinates to geohash: Enter your latitude (-90 to 90) and longitude (-180 to 180), select precision level (1-12), and the geohash generates automatically.
  2. To decode geohash to coordinates: Switch to the Decode tab, paste your geohash string, and instantly see the latitude/longitude with the location on the map.
  3. Adjust precision to control accuracy: Precision 1 covers ~5000km, precision 6 covers ~1.2km, precision 9 covers ~5m, precision 12 covers ~3.7cm.
  4. Enable 'Show Neighbors' to visualize all 8 adjacent geohash cells - essential for proximity search implementations.
  5. Click the geohash to copy it to clipboard for use in your code, database queries, or API calls.

Frequently Asked Questions About Geohash

What is a Geohash and how does it work?

Geohash is a hierarchical spatial indexing system that divides the world into a grid of cells. It encodes latitude and longitude into a single alphanumeric string using base32 encoding. Each additional character increases precision by dividing the cell into 32 smaller cells. For example, 'u4pruydqqvj' pinpoints a specific location, while 'u4pru' represents a larger area containing that point.

What is the precision of different geohash lengths?

Geohash precision varies by string length: 1 char ≈ 5,000km × 5,000km, 2 chars ≈ 1,250km × 625km, 3 chars ≈ 156km × 156km, 4 chars ≈ 39km × 19.5km, 5 chars ≈ 4.9km × 4.9km, 6 chars ≈ 1.2km × 0.6km, 7 chars ≈ 153m × 153m, 8 chars ≈ 38m × 19m, 9 chars ≈ 4.8m × 4.8m, 10 chars ≈ 1.2m × 0.6m, 11 chars ≈ 15cm × 15cm, 12 chars ≈ 3.7cm × 1.8cm.

Why use Geohash instead of storing latitude and longitude separately?

Geohash offers key advantages: (1) Single string storage - easier to index in databases, (2) Prefix-based proximity - nearby locations share common prefixes enabling fast range queries, (3) Hierarchical precision - truncate for less precision without recalculation, (4) URL-safe - can be used directly in URLs and APIs. It's the standard for spatial indexing in Redis, MongoDB, Elasticsearch, and many location-based services.

How do I use geohash for proximity/nearby searches?

For proximity searches, query the target geohash plus its 8 neighbors. This ensures you capture all nearby points even at cell boundaries. Our tool's 'Show Neighbors' feature visualizes these adjacent cells. In databases like Redis, use GEOSEARCH; in MongoDB, use $geoNear with geohash index; in Elasticsearch, use geo_bounding_box queries.

What are the limitations of Geohash?

Geohash has some edge cases: (1) Edge effect - adjacent points may have completely different geohashes at cell boundaries, (2) Non-uniform cells - cells are rectangular, not square, varying by latitude, (3) Not ideal for exact distance - use Haversine formula for precise distance calculations. Despite these, geohash remains the most efficient method for spatial indexing and proximity searches.

How to implement geohash in different programming languages?

Most languages have geohash libraries: JavaScript (ngeohash, latlon-geohash), Python (python-geohash, pygeohash), Java (geohash-java), Go (go-geohash), Ruby (geohash gem). For databases: Redis has built-in GEOADD/GEOHASH commands, MongoDB supports geohash indexes, PostgreSQL has PostGIS extension, and Elasticsearch has native geo_point type with geohash support.

Related Articles