JSON minify — Guide

Minify and compress your JSON by removing unnecessary whitespace.

What it is and when to use it

Minifying JSON strips everything the machine does not need: indentation, padding spaces and newlines. The parsed value stays exactly the same, but the file gets smaller and fits on one line — useful for embedding a payload in an environment variable, a query parameter or a commit. The input side is more forgiving than the output side: parsing goes through JSON5, so comments, trailing commas, single quotes and unquoted keys are all accepted on the way in, and what comes out is strict, compact JSON. If the input cannot be parsed at all, the result is empty rather than a stack of error text.

Strips the whitespace and newlines out of JSON, compressing it onto one line to save transfer size.

How to use it

  1. Paste the formatted JSON
  2. Get the minified result
  3. Copy and use it

A worked example

Fill in sample JSON

{
  "name": "DigDevBox",
  "list": [1, 2, 3]
}

Copy this into the tool, or open JSON minify

Things that trip people up

  • Input is parsed as JSON5, so comments and trailing commas survive — but they are gone in the output, because JSON has nowhere to put them.
  • Key order is preserved as written; minification does not sort keys.
  • Unparsable input yields an empty result, so an empty output means the input was invalid, not that it was already minimal.

Questions people ask

How much smaller does the file get?
For formatted JSON typically 20-40%: whitespace is pure overhead. Minifying does not shorten keys or values the way a binary format would — for transfer size, gzip on the transport layer is the next step.
Is minified JSON still valid?
Yes. Whitespace between tokens is not part of the JSON data model. Minifying requires parsing first, so invalid input errors out instead of producing broken output.
How do I get it back into readable form?
Paste it into the JSON formatter and it is re-indented. Minify and format are inverse operations at the presentation level — the data itself never changes.
Does it also prettify, or only minify?
Only minify — the output is deliberately one line with no indentation. For the readable form there is a separate JSON formatter; keeping the two directions in separate tools makes each one's output predictable.
My file had comments in it — where did they go?
They were accepted on input (JSON5 allows them) and dropped on output, because standard JSON has no comment syntax. If the comments are load-bearing, keep the annotated copy as the source of truth and minify only when shipping.

Next steps

Open the JSON minify tool

Spotted something wrong on this page? Tell us via Contact Us