> json | minify | compress <
// Compress, shrink, and optimize JSON payloads by stripping whitespace; validate before minifying
// Drop a .json file anywhere on the input to load it
Validates Before Minifying
JSON is parsed first; any syntax error is shown clearly so you know exactly which character or position to fix.
Size Comparison Bar
See original size, minified size, and percentage saved in bytes — with a visual bar chart — so you know exactly how much payload your API will save.
Beautify Back
One click to re-pretty-print with 4-space indentation when you need to read the data again.
// ABOUT JSON MINIFICATION
How It Works:
JSON minification parses your input with the browser's JSON.parse, then re-serializes it with JSON.stringify using no indentation. Whitespace inside strings is preserved; whitespace between tokens (spaces, tabs, newlines) is removed. The result is the smallest valid JSON that represents the same data, conforming to ECMA-404 and RFC 8259.
Example:
{ "a": 1, "b": 2 } -> {"a":1,"b":2}
Standards:
- >ECMA-404: The JSON Data Interchange Syntax
- >RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format
- >JSON.parse / JSON.stringify (ECMAScript built-in)
Common Use Cases:
- >Reduce API payload size for mobile and IoT clients
- >Shrink JSON config blobs embedded in HTML or environment variables
- >Validate JSON syntax before deployment
- >Generate compact responses from a sample payload
- >Compare original vs minified byte counts for monitoring
>> frequently asked questions
Q: Does minification change the data?
A: No. Minification only removes formatting whitespace between tokens. The keys, values, ordering of array elements, and nested structure are byte-identical to the parsed input when re-serialized. Whitespace inside string values (for example a literal newline character) is fully preserved because it is part of the data, not the formatting.
Q: Why does my output look identical to my input?
A: If your JSON had no formatting whitespace to begin with, the minified and original sizes will match and the savings counter will read 0%. Try the [BEAUTIFY] button first to add indentation, then re-minify, and you'll see the round-trip is loss-less and the savings number jumps once whitespace is reintroduced.
Q: What happens with invalid JSON?
A: The tool surfaces the parser error message inline so you can locate the bad character. The most common offenders are trailing commas, single-quoted strings, unquoted object keys, JavaScript-style comments, and undefined/NaN values — none of which are valid per ECMA-404 or RFC 8259, even though many languages accept them.
Q: Are byte counts measured in characters or bytes?
A: Bytes. The tool measures UTF-8 byte length using the browser's TextEncoder, so non-ASCII characters such as emoji, accented letters, or CJK glyphs count as multiple bytes each. This matches what your server actually transmits over HTTP and what gzip will see, so the savings figure reflects real wire-cost reduction.
Q: Is my JSON sent to a server?
A: No. Minification runs entirely in your browser using the built-in JSON.parse and JSON.stringify functions — it is fully client-side, with no upload, no telemetry, and no network calls. You can disconnect from the internet, paste a payload, and the tool will continue to compress and validate it just the same.
Q: Can I drop a .json file instead of pasting?
A: Yes. Drag a .json file onto the input textarea and the contents will be loaded for you. Combined with the [SAMPLE] button this gives you three quick ways to populate the input: paste, drag-drop, or load the built-in example payload.