JSON minifier: minify JSON online, free and private
A JSON minifier removes every space, tab and line break that JSON does not need, leaving one compact line that holds exactly the same data. To minify JSON free and privately, paste it into Input JSON or click Upload JSON File. The minified text and the Original Size, Minified Size, Saved and Size Reduction cards appear as you type. Nothing is uploaded: the work happens in your browser, and you can confirm that in the Network tab of DevTools.
Size is counted in UTF-8 bytes, so accented letters and emoji are weighed correctly. The formula is Size Reduction = (original bytes - minified bytes) / original bytes x 100. A small object indented with two spaces measured 147 bytes before and 76 bytes after, a 48.3% reduction. Deeper nesting and wider indentation save more.
The minifier does not rewrite values. Numbers, strings and key order come out exactly as they went in, unlike tools that read the text with JSON.parse and write it back, which turn 1234567890123456789 into 1234567890123456800. To go the other direction and make compact JSON readable, use the JSON formatter.
Table of Use: inputs, settings and results
| You paste | Setting | You get |
|---|---|---|
| Object with name, age, tags and a nested object, indented 2 spaces (147 bytes) | Default | 76 bytes. Saved 71 bytes, Size Reduction 48.3% |
| The same object indented 4 spaces (197 bytes) | Default | 76 bytes. Saved 121 bytes, Size Reduction 61.4% |
| {"a":{"b":{"c":[1,2,3,{"d":null}]}}} | Default | Unchanged: 36 bytes in and out, 0.0% reduction |
| {"id": 1234567890123456789, "price": 10.50} | Default | {"id":1234567890123456789,"price":10.50} with a "Kept exactly" note |
| {"s": "a b // not a comment"} | Default | {"s":"a b // not a comment"}: the spaces and the // inside the string stay |
| A // header line, then {"a": 1, /* inline */ "b": "x//y"} | Remove comments ticked (default) | {"a":1,"b":"x//y"} and a "Comments removed" notice |
| The same input with comments | Remove comments unticked | Validation error: Comments are not allowed in JSON, line 1, column 1 |
| {"a":1,} | Validate before minifying ticked (default) | Validation error: Trailing comma before '}' at line 1, column 7 |
| {"a":1,} | Validate before minifying unticked | {"a":1,} with a "Not valid JSON" warning |
Not sure the JSON is valid before you minify it? Check it first with the JSON validator, which also reports errors by line and column. The same idea applies to other code: the JavaScript minifier and the CSS minifier, the HTML minifier and the SQL minifier strip whitespace from scripts, stylesheets, markup and queries.
Features
- Minifies as you type. There is no Minify button. A "Minifyingโฆ" note shows while a large paste is being processed.
- Size cards. Original Size, Minified Size, Saved and Size Reduction, in bytes, KB or MB.
- Lossless output. Numbers, strings and key order are written back exactly. Numbers too large for JavaScript get a "Kept exactly" note, and duplicate keys are kept and listed.
- Validate before minifying. Ticked by default. Invalid JSON gives a Validation error with the line, column, a How to fix hint and a Show in input button.
- Remove comments (non-standard). Ticked by default. Strips // and /* */ comments and tells you when it did. Unticked, comments are an error.
- Minify text that is not strict JSON. Untick Validate before minifying to strip whitespace from input with trailing commas or single quotes. The output is flagged as still invalid.
- Before & After Comparison. Shows the first 200 characters of each version with their sizes.
- Upload JSON File, Undo, Redo, Copy Minified, Download, Clear. Files up to 25 MB are read on your device, Undo and Redo keep the last 100 snapshots of your input, and Download saves minified.json.
It removes whitespace and, if you allow it, comments. It does not shorten key names, drop nulls or compress the bytes. To compare the original with the minified result, paste both into the text diff tool.
How to minify JSON, step by step
- Paste your JSON into Input JSON, or click Upload JSON File and choose a .json, .txt or .geojson file.
- Leave Validate before minifying ticked so mistakes are caught. If a red Validation error panel appears, fix the problem it describes, using Show in input to jump to it.
- Decide about Remove comments (non-standard). Keep it ticked if the input has // or /* */ comments you want removed, or untick it to treat comments as errors.
- Read the four size cards to see how many bytes you saved.
- Check the text in Minified JSON, and glance at Before & After Comparison.
- Click Copy Minified, or Download to save minified.json. Undo and Redo step through earlier input, and Clear empties the box.
Who can use it
- API and web developers trimming payloads, fixtures and sample responses before they ship.
- DevOps and support engineers who need a config or request body on a single line, for a shell command, an environment variable or a chat message.
- Front-end developers embedding JSON in a page or data attribute, then encoding it with the Base64 encoder or the URL encoder when it has to travel in a URL.
- Data teams shrinking exported files, and converting them afterwards with the JSON to CSV converter.
- Anyone cleaning up a config that has comments, using Remove comments (non-standard) to get plain JSON back.
FAQs
How do I minify JSON online?
Paste your JSON into Input JSON, or click Upload JSON File. The minified text appears in Minified JSON as you type, with cards for Original Size, Minified Size, Saved and Size Reduction. There is no Minify button. Click Copy Minified to put the result on your clipboard, or Download to save it as minified.json.
Does minifying change my JSON data?
No. Only whitespace outside strings, and optionally comments, is removed. Every number, string and key is copied exactly as written, so 1234567890123456789 stays as it is and 10.50 is not rewritten as 10.5, which minifiers built on JSON.parse and JSON.stringify do. Spaces inside strings are kept, and parsers read the minified and indented versions identically.
How much smaller will my JSON get?
The saving is (original bytes minus minified bytes) divided by original bytes, times 100, measured in UTF-8 bytes. It depends on how much whitespace you start with. A small object indented with two spaces went from 147 to 76 bytes (48.3%), and with four spaces from 197 to 76 bytes (61.4%). JSON already on one line saves nothing.
How do I remove comments from JSON?
Leave Remove comments (non-standard) ticked, which is the default. // line comments and /* block */ comments are then stripped, and a note tells you comments were removed. Text that only looks like a comment inside a string, such as a URL with //, is left alone. Untick the option and comments become an error instead.
What does Validate before minifying do?
When it is ticked, the input must be valid JSON, otherwise you get an error with the line, column and a fix instead of output. Untick it to minify text that is not strict JSON, such as a config with trailing commas. Whitespace is removed without checking the syntax, and a warning says the result still will not parse as standard JSON.
What is the difference between minifying and compressing JSON?
Minifying removes whitespace and leaves readable text that any JSON parser can still read. Compression, such as gzip or Brotli, re-encodes the bytes into a binary form that must be decompressed first. They work together: servers usually compress the response, and a minified file is already smaller before that. This tool only minifies.
Should I minify JSON during development?
Usually not. Keep JSON indented in source control and while you work, so it is easy to read and to compare line by line, and minify it for production or before sending it over a network. When you need to read minified JSON again, the JSON formatter turns it back into indented text.
Is my JSON uploaded anywhere?
No. Minification is plain JavaScript running in your browser, so your JSON is never uploaded or stored by ZipConvert. You can check this yourself: open the Network tab in your browser DevTools, paste some JSON, and no request carrying it is sent. Files you choose with Upload JSON File are read on your device in the same way.