Geofence Radius Calculator
Centre + radius → the circle's area, the lat/long bounding box for your database query, and the degree-deltas that make radius search fast.
The two-step pattern every store-locator runs: cheap bounding-box filter on indexed lat/lon columns first (this tool's deltas), exact haversine on the survivors second. The box is ~27% bigger than the circle — that's the price of index speed, refunded by step two.
Formula
⚠️ Great-circle estimates on a spherical Earth (±0.5% vs ellipsoidal) — for surveying, legal boundaries and navigation use geodetic-grade tools and official datums.
Centre + radius → the circle's area, the lat/long bounding box for your database query, and the degree-deltas that make radius search fast.
About Geofence Radius Calculator
'Show everything within 5 km' is two problems wearing one sentence: a circle on a sphere, and a database that only indexes rectangles. This calculator does both sides — the circle's coverage area, and the latitude/longitude deltas that build the bounding-box prefilter every fast radius query uses (with the cos-latitude correction that beginners omit and then wonder why their east-west fences sag). Centre, radius, done: the box is ready to paste into a WHERE clause.
How to use Geofence Radius Calculator
- 1Enter — sensible defaults are pre-filled so you see a worked result immediately.
- 2Read the live results: .
- 3Check the "With your numbers" line to see the formula Δlat = r/111.32 km; Δlon = r/(111.32 × cos φ); box-filter first, exact haversine second substituted step by step.
- 4Adjust inputs (or flip the unit toggle) until the scenario matches yours, then copy or share the result.
Why use Geofence Radius Calculator?
- ✓Instant, free and private — every calculation runs in your browser, nothing is uploaded
- ✓Built on the published formula Δlat = r/111.32 km; Δlon = r/(111.32 × cos φ); box-filter first, exact haversine second with sources cited on the page
- ✓The two-step pattern every store-locator runs: cheap bounding-box filter on indexed lat/lon columns first (this tool's deltas), exact haversine on the survivors second. The box is ~27% bigger than the circle — that's the price of index speed, refunded by step two.
- ✓Switch units, tweak any input and watch every result update live
Frequently asked questions
Why does the longitude delta need the cosine correction?+
Because degrees of longitude shrink with latitude: one degree spans 111.32 km at the equator but only 111.32 × cos(φ) at latitude φ — 78.8 km at 45°, 55.7 km at 60°. A 5-km fence at San Francisco (37.77°) needs ±0.0568° of longitude but only ±0.0449° of latitude. Skip the cosine and your 'circle' becomes an ellipse squashed east-west — queries miss points near the east and west edges, a bug that hides until a user near the fence boundary complains.
What's the standard fast-radius-query pattern?+
Box first, circle second: filter WHERE lat BETWEEN φ−Δlat AND φ+Δlat AND lon BETWEEN λ−Δlon AND λ+Δlon — which a B-tree index executes instantly — then compute exact haversine distance on the few survivors and discard the box's corners (the box is 4r² to the circle's πr², so ~21% of candidates are corner waste). Real spatial engines (PostGIS, geohash/S2/H3 systems) industrialize the same two-phase idea: coarse cells, then exact math.
How big should app geofences actually be?+
Match the radius to both the use case AND the positioning noise: under ~100 m, phone geofencing gets unreliable (GPS drifts 5–30 m urban, and OS-level fencing uses cell/Wi-Fi positioning that's coarser); 100–300 m suits 'arrived at the store' triggers; 1–5 km suits delivery zones and alerts; above that you're doing coverage areas, not fences. Add hysteresis — trigger entry at r but exit at 1.2r — or boundary jitter will fire your fence repeatedly as a stationary phone's fix wanders.
Does the simple box break anywhere on Earth?+
Two famous places: near the poles the cosine blows up (at 89° latitude a 5-km fence spans ±2.6° of longitude; past the pole itself the box concept collapses — use polar-cap logic), and at the antimeridian (±180°) a box can wrap so its 'min' exceeds its 'max' longitude, silently returning nothing — split the query into two boxes there. For the 99.9% of fences between Alaska and Fiji at sane latitudes, this page's deltas are exactly what production systems run.
Related Field tools
Sunrise & Sunset Calculator
Exact rise, set, solar noon and day length for any place and date — the NOAA solar equations with the refraction fine print included.
● LiveGolden Hour & Blue Hour Calculator
Tonight's golden hour and blue hour, computed from sun elevation — the photographer's light windows with the angles that define them.
● LiveDay Length Calculator
Hours of daylight for any date and latitude, how fast it's changing, and the swing between your solstices.
● Live