GeoJSON Minifier

Strip whitespace and round coordinate precision to shrink GeoJSON files

Free GeoJSON minifier — removes all JSON whitespace and optionally rounds coordinates to a chosen decimal precision (5dp is roughly 1 metre) to cut file size for faster web maps. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How much accuracy do I lose by rounding coordinates?

At the equator, 5 decimal places is about 1.1 metres, 6dp is about 0.11 metres, and 4dp is about 11 metres. Web maps rarely need more than 5dp, so trimming from the typical 15 stored digits is lossless for display purposes.

A GeoJSON minifier makes map data files smaller so they download and render faster in the browser. GeoJSON exported from GIS tools is often pretty-printed with indentation and stores coordinates with 15 decimal places of floating-point precision — far more than any web map can display. This free tool removes that overhead client-side, with no upload and no account.

How it works

Two independent transforms run on your data:

  1. Whitespace removal. The input is parsed with JSON.parse and re-serialised with JSON.stringify and no spacing argument, which collapses all indentation and newlines.
  2. Coordinate rounding. The tool recursively walks every array in the document. A coordinate pair is detected as an array whose entries are all numbers; each number is rounded to your chosen decimal precision using Math.round(n * 10^d) / 10^d. Trailing zeros are dropped automatically by JavaScript’s number-to-string conversion, which is where most of the byte savings come from.

Rounding precision maps to real-world distance at the equator like this: 4dp is roughly 11 m, 5dp roughly 1.1 m, and 6dp roughly 0.11 m. Longitude precision shrinks toward the poles, so the figures are an upper bound.

Precision guide for common use cases

Decimal placesGround distance (equator)Suitable for
3~111 mRegional overview maps, country outlines
4~11 mCity-level maps, district boundaries
5~1.1 mStreet-level web maps, most web applications
6~0.11 mHigh-resolution property, infrastructure data

Most consumer web mapping applications (Mapbox, Leaflet, Google Maps JavaScript API) render tiles at resolutions where 5 decimal places is already overkill. The visual difference between 5 and 15 decimal places on a standard screen is zero.

How much file size does minifying actually save?

For illustration, consider a typical administrative boundary file exported from QGIS:

  • Pretty-printed, 15 decimal places: a moderately complex polygon might be 2 MB.
  • Whitespace removed only: roughly 1.4 MB (a modest saving from the indentation).
  • Whitespace removed and rounded to 5dp: roughly 600–800 KB, a 60–70% reduction.
  • Served with gzip compression on top: a further 60–80% reduction because rounded small integers compress far better than long floating-point strings.

The coordinate digits themselves are where the bulk of GeoJSON size lives, not the JSON structure.

Tips and notes

  • For street-level web maps, 5 decimal places is the sweet spot — typically a 50–70% size reduction with no visible change.
  • Keep an unrounded master copy if you need survey-grade accuracy; rounding is lossy and not reversible.
  • Combining this with gzip on your server compounds the saving, because shorter, more repetitive numbers compress better.
  • The tool handles nested geometries (MultiPolygon, GeometryCollection) because it walks the whole tree rather than assuming a flat structure.
  • If you need even more aggressive compression than rounding alone can achieve, consider converting to TopoJSON format, which also deduplicates shared borders between adjacent polygons.
  • The tool processes GeoJSON in memory in your browser — there is no file size limit from the server side, though very large files (tens of megabytes) may be slow to process depending on your device.