Geohashing
maang.io System Design Series
Geohashing interleaves the bits of latitude and longitude and base32-encodes them into a short string, so that points close together share a long common prefix. That single property turns "find nearby" into a cheap prefix query on an ordinary database index β which is how Redis GEO and countless proximity-search systems work under the hood.
This deep dive comes in three parts:
- Foundations & Core Concepts β bit interleaving, base32 encoding, and prefix-as-proximity.
- Internals β precision vs string length, the boundary problem and neighbour cells, with worked numbers.
- Interview β Staff/Principal Q&A: proximity search at scale and the trade-offs vs quadtrees.
Geohashing β Part 3: System Design & Interview Mastery
maang.io System Design Series
What is this?
You can now encode a coordinate by hand, explain the Z-curve, and fix the boundary problem. This chapter is where that turns into an offer. When an interviewer sketches "design Uber's nearby-drivers" or "design a proximity feed," they're not testing whether you can recite how bits interleave β they're watching whether you reach for a geohash at the right moment, size the cells correctly, and defend it against a Quadtree when they push back. That judgment is the senior signal; the algorithm is table stakes.
We'll do two things: first see where geohashing lands in real designs with a worked mini-architecture, then run a mock interview β for each question, what they're really asking, a model answer, and the senior line that says you've shipped this for real.
The one-line idea: interviewers use geohashing to test whether you can turn a 2-D "who's near me?" question into a 1-D index scan on infrastructure you already run β and then live honestly with the costs: the boundary problem, uniform cells that hotspot in dense areas, and the coarse-then-fine two-stage filter every real answer needs.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson