consolelog.tools

JSON Minifier

Strip whitespace from JSON live — with lenient repair (comments, trailing commas, single quotes), precise code-frame errors, and an accurate UTF-8 compression summary.

About this ToolHow it works, benefits & use cases

Compress JSON to its smallest valid form by stripping every space, newline and indentation character while keeping the structure intact. The minifier validates as you paste: invalid input surfaces a code-frame error with the line, column and a caret-marked snippet, and an optional lenient repair mode first normalises comments, trailing commas, single quotes and unquoted keys so that not-quite-JSON still compresses cleanly. Each run reports an accurate UTF-8 compression summary — original bytes, minified bytes, bytes saved and the percentage reduction — measured with a real text encoder rather than character counts, so multi-byte characters are weighed correctly. A structure summary breaks down the document by root type, key count, nesting depth and per-type element counts. The minified output streams live and can be copied, downloaded as a .json file, or shared via URL, and nothing is ever uploaded — it all runs locally in your browser.

How to Use

  1. 1Optionally enable "Repair (lenient)" if your input contains comments, trailing commas, single quotes or unquoted keys.
  2. 2Paste your JSON into the input panel — the minified result appears live — or click "Load example".
  3. 3Press "Minify JSON" to validate the input and confirm the compression.
  4. 4Check the output panel header and Compression section for the byte savings and percentage reduction.
  5. 5Copy the minified JSON, download it as minified.json, or share it with the generated URL.

Key Benefits

  • Removes all optional whitespace to produce the smallest valid JSON
  • Accurate UTF-8 byte accounting — original, minified, saved and percent
  • Lenient repair handles comments, trailing commas, single quotes and unquoted keys
  • Code-frame errors with line, column and a caret-marked snippet for invalid input
  • Structure summary: root type, total keys, depth and per-type counts
  • Live minification with copy, .json download and shareable URLs
  • Runs entirely in the browser — your JSON is never uploaded

Common Use Cases

  • Shrinking JSON config or fixtures before embedding them in source or a bundle
  • Reducing payload size for an API request body or a data attribute
  • Measuring exactly how many bytes whitespace adds to a response
  • Compressing JSON5-style hand-written data into strict, minimal JSON
  • Preparing a compact one-line JSON value to paste into a shell command or query

Options

Accept comments, trailing commas, single quotes, unquoted keys

0 characters · live

Paste JSON above to minify it live.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools