JSON Minifier
Paste a pretty-printed JSON document and get a single-line version with every unnecessary byte stripped: spaces between tokens, newlines, trailing whitespace, JSONC comments. Output is byte-count comparable to the shortest possible encoding of the same data, ready for an embed in a <script>, a URL parameter or a payload that pays by the byte.
How to minify JSON
-
1
Paste the JSON
Pretty-printed or already partially minified. Input is parsed and re-serialized.
-
2
Minify
All whitespace between tokens is removed; comments are stripped; numbers are kept as-is.
-
3
See the size delta
Before/after byte counts and percent reduction.
-
4
Copy the output
One-line JSON ready to paste into a code file or API request.
What gets removed
- Whitespace between tokens: spaces, tabs, newlines.
- Comments (JSONC-style
//and/* */), stripped because strict JSON forbids them. - BOM and leading whitespace at the document start.
What does NOT get removed
- Values: every string, number, boolean and null is preserved exactly.
- Number formatting: every number is kept exactly as written,
1.50stays1.50and1e-3stays1e-3. The tool preserves the precision you entered. - Order of keys: objects keep their original insertion order.
Why minify JSON
- Smaller payloads: a pretty-printed 120 KB config can shrink to 70 KB; that matters for every request.
- Inline embeds: when you drop JSON into a
<script>tag or a URL param, whitespace is wasted bandwidth. - Hash stability: two semantically equal JSON documents with different whitespace hash to different values. Minifying first gives a consistent hash (though true canonicalization also sorts keys).
Byte savings reference
| Input | Pretty (2-space) | Minified | Savings |
|---|---|---|---|
| Small config (50 keys) | 1.8 KB | 1.1 KB | 39% |
| API response (5 KB nested) | 6.2 KB | 4.1 KB | 34% |
| Large data dump | 1.2 MB | 0.8 MB | 33% |
After gzip, the difference shrinks dramatically, gzip already compresses whitespace efficiently. Minify for the raw-byte case (URLs, inline embeds); rely on gzip for the over-the-wire case.
When NOT to minify
- Configuration files stored in version control, readability wins over bytes.
- Files humans edit, nobody edits minified JSON by hand without regretting it.
- Debug artefacts, a single-line 400 KB JSON in a crash log is impossible to read.
Common mistakes
- Minifying JSON that depended on comments. The comments are stripped and the parser behaviour may change if you had TODO markers.
- Minifying floating-point numbers. Some tools re-serialize
0.1differently than the input; this tool preserves the string representation exactly. - Using minify as compression. Gzip saves more bytes than minification for text. Combine both, do not substitute.
Frequently Asked Questions
Typically 30-40% smaller for pretty-printed input. The saving comes almost entirely from whitespace; the actual data is unchanged. After gzip, the difference between minified and pretty is usually under 5% because gzip handles whitespace efficiently.
The tool preserves the exact string form of numbers. 1.50 stays 1.50, 1e-3 stays 1e-3. Some minifiers normalize, this one is conservative by default so you never see unintended precision loss.
No. Minification runs entirely in your browser. Pasted JSON does not leave your machine, safe for API responses with tokens or private configs.
Yes, comments are tolerated on input and stripped in the output (strict JSON does not allow them). If you need to preserve the comments, keep a pretty-printed JSONC source and minify only at deploy time.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
Tool available in other languages
- JSON-minifierare [SV]
- مُختصر بيانات JSON [AR]
- JSON-minifier [NL]
- Minifikator formatu JSON [PL]
- Bộ rút gọn JSON [VI]
- เครื่องย่อข้อมูล JSON [TH]
- Minificador JSON [ES]
- JSON圧縮ツール [JA]
- Minifier JSON [ID]
- Minificateur JSON [FR]
- JSON-Minifier [DE]
- Minificador de JSON [PT]
- JSON 압축기 [KO]
- Минифайер JSON [RU]
- JSON Minifier [TR]
- JSON 压缩器 [ZH]
- Minificatore JSON [IT]