Geohash encoder and decoder
Convert coordinates to a geohash or decode its cell center and bounds, with GeoJSON export.
A clear answer. Here’s how.
Uses the standard geohash alphabet 0123456789bcdefghjkmnpqrstuvwxyz. Starting with longitude, alternately bisects longitude [-180, 180] and latitude [-90, 90], writing five binary choices per character. A coordinate on a midpoint belongs to the upper half; the outer limits are accepted in their edge cells. Decoding reverses those choices to recover the bounds and their midpoint. Input coordinates are geographic decimal degrees, not projected metres. Decode accepts 1 to 12 characters after trimming and lowercasing; encode accepts a whole length in that range. The center is a representative point for a cell and does not reconstruct the original location. JSON details keep latitude and longitude explicitly named; the GeoJSON Polygon and bounding box use longitude-first positions and a closed counterclockwise outer ring. Cell dimensions in metres vary with latitude; no distance or location accuracy is inferred. All calculation is local, without a map or geocoding request.
How this is checked
4 reference checks passed These 4 cases were run when this page was built, on 3 December 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Output hash
- Expected, and what Toolmoz gave
- text expected c0w3h, Toolmoz c0w3h
- Where the expected answer comes from
- PostGIS ST_GeoHash example: ST_Point(-126, 48) at five characters gives c0w3h.
- Allowed difference
- exact
Case 2
- Inputs
- Operation decodeGeohash to decode 9qqj
- Expected, and what Toolmoz gave
- text expected { "geohash": "9qqj", "precision": 4, "center": { "latitude": 36.123046875, "longitude": -115.13671875 }, "bounds": { "south": 36.03515625, "west": -115.3125, "north": 36.2109375, "east": -114.9609375 } }, Toolmoz { "geohash": "9qqj", "precision": 4, "center": { "latitude": 36.123046875, "longitude": -115.13671875 }, "bounds": { "south": 36.03515625, "west": -115.3125, "north": 36.2109375, "east": -114.9609375 } }
- Where the expected answer comes from
- PostGIS ST_PointFromGeoHash at four characters gives longitude -115.13671875 and latitude 36.123046875; 10 bits per axis give longitude width 360/1024 and latitude height 180/1024, establishing the listed bounds.
- Allowed difference
- exact
Case 3
- Inputs
- Latitude (degrees) 0Longitude (degrees) 0Geohash length 1Output geojson
- Expected, and what Toolmoz gave
- text expected { "type": "Feature", "bbox": [ 0, 0, 45, 45 ], "properties": { "geohash": "s", "precision": 1, "center": { "latitude": 22.5, "longitude": 22.5 } }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0, 0 ], [ 45, 0 ], [ 45, 45 ], [ 0, 45 ], [ 0, 0 ] ] ] } }, Toolmoz { "type": "Feature", "bbox": [ 0, 0, 45, 45 ], "properties": { "geohash": "s", "precision": 1, "center": { "latitude": 22.5, "longitude": 22.5 } }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 0, 0 ], [ 45, 0 ], [ 45, 45 ], [ 0, 45 ], [ 0, 0 ] ] ] } }
- Where the expected answer comes from
- At the origin the first longitude/latitude choices are 11000 (base32 index 24, s), giving the cell from zero to 45 degrees on each axis. RFC 7946 requires longitude-first positions and a closed outer ring.
- Allowed difference
- exact
Case 4
- Inputs
- Latitude (degrees) -90Longitude (degrees) -180Geohash length 1Output hash
- Expected, and what Toolmoz gave
- text expected 0, Toolmoz 0
- Where the expected answer comes from
- The southwest extreme selects the lower half for all five bits: binary 00000 is alphabet index zero.
- Allowed difference
- exact
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Operation
- Encode coordinates
- Latitude (degrees)
- 48
- Longitude (degrees)
- -126
- Geohash length
- 5
- Output
- Cell details (JSON)
Example result
{
"geohash": "c0w3h",
"precision": 5,
"center": {
"latitude": 48.01025390625,
"longitude": -126.01318359375
},
"bounds": {
"south": 47.98828125,
"west": -126.03515625,
"north": 48.0322265625,
"east": -125.9912109375
}
}Coordinates and bounds are decimal degrees. The decoded center represents the cell, not the original exact location. GeoJSON positions use longitude, latitude order. No map, location permission or network lookup is used.