How to use the geohash encoder and decoder
- Choose Coordinates to geohash or Geohash to coordinates.
- To encode, enter latitude from -90 to 90, longitude from -180 to 180 and the number of characters from 1 to 12.
- To decode, enter a geohash of up to 12 characters.
- Read the geohash, the center of its cell, the corners, the error margins and the eight neighboring cells.
Formula
start with the whole world: latitude -90 to 90 and longitude -180 to 180
step 1 halves longitude, step 2 halves latitude, and so on, alternating; the upper half gives bit 1 and the lower half bit 0
every 5 bits become one of 32 characters: 0 to 9, then b to z without a, i, l and o
The alphabet leaves out a, i, l and o. A geohash of n characters has 5n bits, and each bit halves the box once.
A point in Denmark
The point 57.64911, 10.40744 with 11 characters is u4pruydqqvj. Its cell runs from latitude 57.6491100 to 57.6491113 and from longitude 10.4074390 to 10.4074404, which is a few millimeters wide. Its parent, u4pruydqqv, is the same point at 10 characters, a cell about 1.2 meters wide.
Decoding ezs42 gives a cell from 42.58301 to 42.62695 north and from 5.625 to 5.58105 west, with a center of 42.60498, -5.60303. Each added character makes the cell smaller by a factor of 32.
Prefixes and neighbors
Every geohash that starts with the same letters lies inside the same larger cell, so a prefix search finds points near each other. But two points just either side of a cell edge can have very different geohashes. To search around a point, check the neighboring cells too, which this page lists in the table. At the top or bottom edge of the world there is no neighbor beyond the pole, and cells wrap across longitude 180.
Sizes and accuracy
A 5 character geohash covers about 4.9 km by 4.9 km, 7 characters about 153 m, 9 characters about 4.8 m and 11 characters about 15 cm near the equator. Cells are narrower for longitude as you move toward the poles. For another way to name places, see the Plus Code Converter, and for coordinate formats the Coordinate Format Converter and the Great Circle Distance Calculator.
Assumptions and limits
- Coordinates are decimal degrees on the WGS 84 style latitude and longitude scale.
- The error margins are half the width and height of the cell.
- Neighbors are found by moving one cell from the center and encoding again.
- Nothing is sent from your device.
Frequently asked questions
Why does a longer geohash mean more precision?
Each extra character adds five more halvings of the map, so the cell shrinks by a factor of 32. More characters name a smaller area.
Why can nearby points have different geohashes?
A geohash names a cell, and two points on either side of a cell edge belong to different cells even if they are meters apart. Check neighboring cells when you search by prefix.
What letters are left out?
The letters a, i, l and o are not used, to avoid confusion with digits. The alphabet has 32 characters: the digits and the letters b to z without those four.
Is the cell center the original point?
No. Decoding returns the center of the cell. The original point is somewhere inside the cell, within the error margins shown.