Movable Type Home Page

Movable Type Scripts


A geohash is a convenient way of expressing a location (anywhere in the world) using a short alphanumeric string, with greater precision obtained with longer strings.


Enter latitude, longitude & precision to obtain geohash; enter geohash to obtain latitude/longitude.


A geohash actually identifies a rectangular cell, each extra character identifies one of 32 sub-cells. Big Data Modelling has a good visual explanation.

The cell sizes of geohashes of different lengths are as follows; note that the cell width reduces moving away from the equator (to 0 at the poles):

Length Cell width Cell height
1 5,000km × 5,000km
2 1,250km × 625km
3 156km × 156km
4 39.1km × 19.5km
5 4.89km × 4.89km
6 1.22km × 0.61km
7 153m × 153m
8 38.2m × 19.1m
9 4.77m × 4.77m
10 1.19m × 0.596m
11 149mm × 149mm
12 37.2mm × 18.6mm

Nearby locations generally have similar prefixes, though not always: there are edge-cases straddling large-cell boundaries; in France, La Roche-Chalais (u000) is just 30km from Pomerol (ezzz). A reliable prefix search for proximate locations will also search prefixes of a cell’s 8 neighbours. (e.g. a database query for results within 30-odd kilometres of Pomerol would be SELECT * FROM MyTable WHERE LEFT(Geohash, 4) IN ('ezzz', 'gbpb, 'u000', 'spbp', 'spbn', 'ezzy', 'ezzw', 'ezzx', 'gbp8'). Whether this would offer significant (or any) performance gains over a latitude/longitude bounding box search I’ve yet to check.

Fun geohashes: ‘sunny’ is in Saudi Arabia, ‘fur’ in Greenland, ‘reef’ in the Coral Sea, ‘geek’ in Iceland (sadly, ‘eu’ is in the Maghreb, not Europe, and ‘queen’ [Priscilla?] is lost in the Australian desert).

See below for the JavaScript source code, also available on GitHub. These functions should be simple to translate into other languages if required. It’s also available as an npm package.

OSI MIT License I offer these scripts for free use and adaptation to balance my debt to the open-source info-verse. You are welcome to re-use these scripts [under an MIT licence, without any warranty express or implied] provided solely that you retain my copyright notice and a link to this page.

Paypal donation If you would like to show your appreciation and support continued development of these scripts, I would most gratefully accept donations.

If you have any queries or find any problems, contact me at ku.oc.epyt-elbavom@oeg-stpircs.

© 2014–2015 Chris Veness