A JSON minifier removes the spaces, tabs and line breaks that make JSON readable but that parsers do not need. Paste formatted JSON and the tool returns the same data on one line, with the original size, the new size and the percentage saved. Invalid JSON is rejected with the line and column of the error.
How to use the JSON Minifier
- Paste your JSONPaste formatted or partly formatted JSON into the box.
- Check the savingsThe minified JSON appears with the size before, the size after and the percentage saved.
- Copy or downloadCopy the single-line result or download it as a .json file.
How the JSON minifier works
The JSON minifier parses your text and writes it back with no whitespace between tokens. Spaces inside strings are data, so they are kept exactly. The result means the same thing to every JSON parser, it is simply shorter.
Because the text is parsed first, the tool also acts as a syntax check: if there is a trailing comma, a missing quote or another mistake, you get an error with the line and column instead of broken output. Three side effects of parsing are worth knowing:
- Numbers are written in their shortest form, so
1.50becomes1.5and1e3becomes1000. - Integers beyond about 16 digits cannot be held exactly by JavaScript and may change. Keep such IDs as strings.
- If an object repeats a key, only the last value is kept.
When minifying JSON helps
Indented JSON is often 20 to 40 percent whitespace, depending on how deeply it is nested. Minifying is useful when you:
- embed JSON in a page, for example a JSON-LD block or a data attribute;
- store JSON in a database column, a cookie or local storage, where every byte counts;
- paste a payload into a command line, an environment variable or a single-line log;
- ship static data files that are downloaded by every visitor.
If your server already compresses responses with gzip or Brotli, the extra saving over the network is smaller, because repeated spaces compress very well. Minified files still parse a little faster and take less room on disk.
Minifying is lossless for the data, but it does discard the layout. Keep the readable version in source control and treat the minified file as a build output that can be regenerated at any time.
Nothing is uploaded: the work happens in your browser. To make minified JSON readable again, paste it into the JSON formatter.
Frequently asked questions
What does a JSON minifier do?
It removes all whitespace that is not inside a string: indentation, spaces after colons and commas, and line breaks. The data stays the same and the file gets smaller.
Is minified JSON still valid?
Yes. Whitespace between tokens is optional in JSON, so any parser reads minified JSON exactly as it reads the formatted version.
How much smaller will my JSON get?
It depends on the indentation and nesting. Typical formatted JSON shrinks by roughly a fifth to two fifths. The tool shows the exact bytes saved for your input.
Can I undo minification?
Yes. Paste the minified text into a JSON formatter to get indented JSON back. Only the original spacing style is lost, not the data.
Is my JSON uploaded anywhere?
No. The minifier runs locally in your browser and does not send your data to any server.
Last updated 24 November 2026 by the TheTechFolk team.