Skip to content
DevTinyTools

JSON Minifier

Remove every optional byte from a JSON document. The output is checked by the same parser that validates the input, and the before/after counts show exactly what was saved.

Runs entirely in your browser — your JSON is never uploaded.

0 chars
0 chars

Character counts are measured on the text exactly as entered. Byte counts are UTF-8 encoded sizes, which is what a network response or file on disk would use.

How to minify JSON

  1. Paste an indented document into the left panel, or press “Load example” for a verbose sample with nested objects.
  2. Press Minify JSON The document is parsed first, so invalid input fails loudly instead of producing a broken result.
  3. Read the comparison above the status line: characters before and after, characters saved, and the reduction percentage.
  4. Copy or download the compact output. The downloaded file is UTF-8 encoded JSON with a timestamped name.

What minification actually removes

JSON uses whitespace only as a separator between tokens. Everything else — the quotes around a key, the colon after it, the comma between members — is structural and has to stay. So a minifier removes:

  • Indentation at the start of every line
  • Line breaks between members and array items
  • Spaces around colons and commas
  • Trailing newlines at the end of the document

It does not remove or reorder anything inside a string, and it does not touch the keys themselves. Minified JSON is not compressed JSON — it is the same document with the formatting taken out.

When it is worth doing

  • Request and response bodies that are measured in raw bytes, for example payloads stored in a database column or embedded in a log line.
  • Bundled fixtures used by tests, where readability is provided by the formatter on demand rather than by the file itself.
  • Inline JSON inside an HTML attribute or a script tag, where line breaks and indentation add bytes to every page view.

Minifying is usually the wrong choice for anything a human reviews: config files in a repository, example payloads in documentation, and anything that appears in a code review. A single-line diff of a minified file tells you nothing about what changed.

Characters, bytes and what the numbers mean

Character counts are taken from the text exactly as it appears in the editor. Byte counts are the UTF-8 encoded size, which is what a file on disk or a network response would contain. The two differ as soon as a document contains non-ASCII text: an accented letter or a CJK character takes two or three bytes even though it counts as one character.

That is why the summary reports both. A document full of non-ASCII strings can have a modest character reduction and a larger absolute byte reduction — or the other way round, if the indentation was mostly single spaces.

To go the other way, use the JSON formatter to pretty-print the result again, or the validator if you only want to know whether a document parses.

Frequently asked questions

What exactly gets removed?
Whitespace between tokens: spaces, tabs and line breaks that sit outside string values. Nothing inside a string is touched, so an address such as "1 Main St, Suite 4" keeps its spaces, and escaped characters like \n stay escaped.
Can minifying change my data?
The structure and values are preserved, but re-serialization normalises number formatting: 1.0 becomes 1, 1e3 becomes 1000, and -0 becomes 0. If a document repeats a key inside the same object, only the last occurrence survives, because that is how JSON parsers resolve duplicates. Integers beyond 2^53 can lose precision when parsed as JavaScript numbers.
How much smaller will my document get?
It depends entirely on how much indentation and line breaking the input has. A pretty-printed file with four-space indents and one value per line typically shrinks a lot; a document that is already minified will not shrink at all, and this tool reports that instead of pretending otherwise.
Does minifying replace gzip or Brotli?
No, and it is worth being precise about the difference. HTTP compression already removes repeated whitespace on the wire, so the transfer-size gain from minifying is usually much smaller than the raw byte difference suggests. Minification still helps where compression is not applied — embedded JSON in a build artefact, values stored in a database, or payloads passed to a system that measures the raw body.
Can I get the indentation back?
Yes. The whitespace itself is gone, but the data is intact, so pasting the minified output into the JSON formatter reproduces a readable document. You will not get the original layout back, only an equivalent one.
Is there a size limit?
Up to 2,000,000 characters, processed in the tab. Very large documents are limited by the memory available to your browser rather than by a server quota, since there is no server involved.
Is the JSON uploaded while minifying?
No. The text is parsed and re-serialized locally with the browser's own JSON functions. No request is made, and nothing is written to storage or analytics.