JSON Minifier: Minify JSON, JSONC, and JSON Lines

Remove every byte of whitespace JSON does not need, with a hand-written streaming tokenizer that copies numbers and strings exactly as written, so 12345678901234567890 and 1.10 survive untouched. Strip comments and trailing commas from JSONC or JSON5-style configs, minify JSON Lines record by record, and compare UTF-8, gzip, and deflate sizes. Everything runs in this browser tab.

Input syntax

Turn off the first three boxes for strict RFC 8259 parsing.

Extras Change data
Ctrl or Cmd + Enter also minifies.

Ready.

0 characters

Paste text, drop a file here, or load one. Inputs up to 1,000,000 characters minify as you type; larger ones wait for the Minify button.

Size

MeasureUTF-8 bytesgzipdeflate
Original---
Minified---
Saved---

gzip and deflate sizes come from your browser's CompressionStream at its default level.

What changed

  • Nothing minified yet.

How it works and limits

  • No JSON.parse round trip. A hand-written tokenizer validates the grammar and copies each number and string token verbatim. Only whitespace, comments, and trailing commas are dropped unless you turn on an extra.
  • Strict by choice. With the three syntax boxes off, input must be RFC 8259 JSON: no comments, trailing commas, single quotes, leading zeros, or raw control characters in strings. Errors give a line and column (columns count UTF-16 code units, as most editors do).
  • JSON5-lite covers the common config syntax listed above. Infinity, NaN, and identifier keys written with \u escapes are reported as errors because they have no faithful strict-JSON form.
  • Extras change data. Sorting and dropping fields build an in-memory tree, so they use more memory on very large files; escape normalization works token by token. Duplicate keys are always kept and counted, never merged.
  • Large files are processed in short slices with a progress bar and Cancel. Files over 2,000,000 characters stay in memory with a read-only preview, and outputs over 1,000,000 characters show a preview; Copy and Download always use the full result.
  • Sizes are exact UTF-8 byte counts. Compressed sizes are measured with CompressionStream; if your browser lacks it, they are marked unavailable rather than estimated. Files are read as UTF-8.
  • Privacy. Nothing is uploaded or saved. Closing the tab discards your data.