geoprimsField-grade geospatial math

Geohash encoder

The geohash for a latitude and longitude at precision 1 to 12, with the cell's size and bounds.

Go the other way: Geohash decoder →

A published result changed on 2026-09-19: The geohash encoder, map tile for a point, tile bounds, H3 grid disk, and haversine distance are now stable, so their results no longer carry the EXPERIMENTAL_TOOL warning; the Web Mercator clamp and pentagon warnings moved to the first position. Each matches published worked examples (Wikipedia, the mercantile README, the Bing Maps Tile System, H3 C, and Rosetta Code) and agrees with a separately written library on 250 to 1,000 cases. No numbers changed. Changelog

dppn5fyxx

The geohash is dppn5fyxx, a cell about 3.63 m wide.

Cell height
Cell width
South
West
North
East
Provenance
Computed by
indexing.geohash.encode 1.0.0, core 0.1.0
Model
Interleaved longitude and latitude bisection bits, base-32 encoded; sizes on the mean-radius sphere
Accuracy
Exact cell; sizes within 0.5% (spherical)
Notes
None
Cites
Niemeyer, G., geohash.org, Geohash (public domain algorithm)

Something look off?

Your values

Showing an example. Change anything.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: Interleaved longitude and latitude bisection bits, base-32 encoded; sizes on the mean-radius sphere

Show your work

  1. Bits of precision

    bits = 5 per character, split between longitude and latitude

    9 characters × 5 = 45 bits

  2. Cell at that precision

    the cell those bits narrow the world to

    4.77 m tall by 3.63 m wide = 4.77 m tall

  3. Geohash

    the cell's bits written in base 32

    40.446111°, -79.982222° at 9 characters = dppn5fyxx

The same steps an agent gets from the MCP server with explain: true.

Accuracy: Exact cell; sizes within 0.5% (spherical)

When to use this: Use this to turn a position into a short string that sorts by location: geohashes are used as database keys, for bucketing points, and for coarse proximity search, because a shared prefix usually means nearby. It reports the cell's size and bounds at the precision you choose. It is also the way to bucket points for aggregation without a spatial index: group rows by a prefix of the geohash and you have a grid, at the precision the prefix length chooses.

Limitations: The string names a cell whose size depends on its length, from thousands of kilometers at one character to centimeters at twelve, and the cells narrow toward the poles. Prefix similarity is a rough proxy for nearness, not a distance: points either side of a cell boundary, the equator, or the prime meridian can have very different geohashes. Cell sizes step by factors of eight and four alternately as characters are added, so the precision you want often falls between two lengths.

Worked example: Pittsburgh at precision 9. Source: add-spatial-indexing-and-raster scenario: dppn5fyxx. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

Latitude
40.446111 deg
Longitude
-79.982222 deg
Precision
9

You get

Geohash
dppn5fyxx
Cell height
4.77 m
Cell width
3.63 m
South
40.4460812°
West
-79.9822283°
North
40.4461241°
East
-79.9821854°

Review: Not yet independently reviewed by a GIS professional.

Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Changes

Checked against: 23 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources