geojsonkit.org
GeoJSON utilities, in the browser
Say hi →

GeoJSON Formatter

Pretty-print your GeoJSON with a chosen indent, or minify it to a single line for embedding. 100% in-browser.

GeoJSON Formatter

updated 8 June 2026

Drop a .geojson file, or

What this tool does

It parses your GeoJSON with the browser's own JSON.parse and re-serializes it with the indent you choose — Pretty-print expands it onto indented lines, Minify collapses it to a single line. It only touches whitespace: coordinates, key order, and structure come out exactly as they went in.

The intent it closes: "I have a wall of minified GeoJSON I need to read" — or the reverse, "I have a readable file I need to shrink before committing or embedding it." Because GeoJSON is just JSON with a spatial shape, this works on any valid JSON, but the defaults and the .geojson file handling are tuned for feature data. It does not check RFC 7946 validity — for that, the Validator is the right tool.

How this tool works

One click runs a two-step pass, entirely in your browser.

1. Parse

Your text goes through JSON.parse. If it isn't valid JSON — a trailing comma, an unclosed bracket, a smart quote — the status bar shows JSON parse error and nothing is written to the output pane. A clean parse is the only requirement; the structure doesn't have to be valid GeoJSON.

2. Re-serialize

The parsed object is written back out with JSON.stringify using your indent. Pretty-print uses the Indent value (default 2); Minify forces indent 0 and strips every optional byte. Object key order is preserved as the browser parsed it, so a type field that led each object still leads it. The status bar reports the action — Formatted with indent=2. or Minified. — and Download saves the result as formatted.geojson.

Options

Indent

How many spaces per nesting level, capped at 8. 2 is the web standard; 4 reads a little easier for deeply nested GeometryCollection structures. Setting it to 0 is the same as minifying.

Pretty-print vs. Minify

Pretty-print adds the newlines and spacing that make a properties object or a coordinate array editable by hand. Minify collapses everything to one line — worth it for production payloads, where stripping the "invisible" characters typically shaves 20–30% off the file size.

Example

Input (minified):

{"type":"Feature","geometry":{"type":"Point","coordinates":[12,34]},"properties":{"name":"Test"}}

Output (pretty-printed, 2-space indent):

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      12,
      34
    ]
  },
  "properties": {
    "name": "Test"
  }
}

Tips & common pitfalls

  • Formatting never changes coordinates. It only adds or removes whitespace. If a high-precision file is still huge after minifying, the decimals are the cause — use Simplify to trim precision and vertices.
  • Key order is usually preserved. JSON.parse keeps object key order, so type stays where it was — though strictly numeric keys can be reordered by the engine.
  • Watch for a BOM. Some Windows editors prepend a Byte Order Mark; a "Unexpected token" error at position 0 is usually that.
  • Trailing commas are illegal JSON. When hand-editing features, make sure the last entry has no comma after its closing brace.

Troubleshooting

I get a "JSON parse error" / "Unexpected token" message.

The input isn't valid JSON. The browser's error usually names a position; check for missing quotes around keys, unclosed brackets, smart quotes, or trailing commas.

The "Download" button isn't working for a huge file.

Very large files (200 MB+) can hit browser limits for Blob URLs. Click Minify first to shrink the string, then Copy and paste into a local editor like VS Code.

My properties look reordered after formatting.

Order is preserved for normal keys, but some engines reorder strictly numeric keys. If a specific key sequence matters, double-check the output before deploying.

FAQ

Does this support TopoJSON?

No — this is strictly GeoJSON (and any plain JSON). TopoJSON uses a different topology-based structure; convert it to GeoJSON first.

Does formatting change the actual coordinate values?

No. It only changes whitespace. For coordinate-level changes use Simplify.

Is my data sent to a server?

Never. Everything runs in your browser via JavaScript — your GeoJSON never leaves your machine, and the page works offline once loaded.

What's the maximum indent?

Capped at 8 spaces. More than that makes most GeoJSON unreadable on a normal monitor anyway.