GeoJSON Minifier

Minify GeoJSON data by removing whitespace and reducing coordinate precision to shrink file size.

How GeoJSON Minification Works

This tool reduces GeoJSON file size in two ways: it removes all unnecessary whitespace (spaces, tabs, newlines) and optionally reduces coordinate precision. Together these can shrink files by 30–70% depending on the original formatting and coordinate precision.

Use the precision control to set how many decimal places coordinates should keep. Six decimals gives roughly 11 cm accuracy, which is more than sufficient for most web mapping applications. Reducing from 15 decimals (common in raw GPS exports) to 6 removes 9 characters per coordinate — across thousands of coordinates, this adds up to significant savings.

Coordinate Precision and File Size

DecimalsAccuracyBest For
1~11 kmContinental-scale overview maps
3~110 mCity-level boundaries and regions
5~1.1 mStreet-level mapping and parcels
6~11 cmGeneral-purpose web mapping (recommended default)
8~1.1 mmSurvey-grade data (rarely needed for web)

Consumer GPS hardware is accurate to roughly 3-5 meters under ideal conditions, which corresponds to about 5 decimal places. Storing 15 decimal places from raw GPS data implies sub-atomic precision that does not exist — trimming to 6 decimals loses no real accuracy while saving substantial file size.

When to Minify GeoJSON

  • Serving GeoJSON over HTTP where bandwidth matters
  • Embedding GeoJSON directly in JavaScript bundles
  • Storing data in size-constrained databases or caches
  • Reducing payload size for mobile applications
  • Preparing files for APIs that enforce payload size limits

For even smaller files, consider simplifying the geometry to reduce vertex count, or converting to TopoJSON which uses topology to eliminate redundant coordinates.

Minification vs. Compression

Minification and HTTP compression (gzip or Brotli) are complementary techniques. Minification reduces the raw file size by removing whitespace. Compression reduces the transfer size by encoding patterns more efficiently. For the best results, minify your GeoJSON first, then serve it with gzip or Brotli compression enabled on your web server.

A 10 MB pretty-printed GeoJSON file might minify to 6 MB, then compress to 1.5 MB over the wire. Without minification, the same file would compress to roughly 2 MB — minification still saves bandwidth even when compression is enabled because removing redundant whitespace lets the compression algorithm focus on meaningful data.

Programmatic Equivalent

In JavaScript, minification is simply:

JavaScriptconst minified = JSON.stringify(geojson);

To also reduce precision, use Turf.js truncate before stringifying:

JavaScriptconst reduced = turf.truncate(geojson, { precision: 6 });
const minified = JSON.stringify(reduced);

The opposite of minification is pretty printing, which adds whitespace back for readability during development.