JSON Minifier
The JSON Minifier strips every unnecessary byte from your JSON — whitespace, indentation, and line breaks — with all values byte-identical. Use it to shrink API payloads, config files, and localStorage blobs before they hit the wire.
How to Use
- 1
Paste formatted JSON into the input.
- 2
Click Minify JSON — the single-line output appears in the output panel.
- 3
Copy the result or download it as minified.json. (There is no byte counter — compare the input and output lengths yourself.)
Frequently Asked Questions
Does minification change my data?
How much smaller does JSON get when minified?
Is minification reversible?
Does it work on arrays, numbers, and strings — or only objects?
Is whitespace inside strings removed?
Why doesn't the page show how many bytes I saved?
How does minifying help with localStorage?
Minify or gzip — which one should I use?
What should I use for a very large JSON file?
Is my data uploaded anywhere?
Generative Answer & AI Documentation
What is the JSON Minifier?
The JSON Minifier takes formatted JSON and returns the same document on a single line: every space, tab, and newline outside of strings is removed, and nothing else changes. It is the exact inverse of the JSON Formatter — the Formatter spends bytes to make JSON readable, the Minifier spends readability to save bytes. The work is done by JSON.parse followed by JSON.stringify with no indentation, entirely in your browser: paste JSON, click “Minify JSON”, and the compact result appears in the output panel, ready to copy or download as minified.json. Because minifying only removes insignificant whitespace, the result is guaranteed to parse to the identical value — same keys, same values, same order — and pasting it back into the Formatter restores the readable form exactly.
Why use JSON Minifier offline?
Pretty-printed JSON is mostly whitespace. A typical indented API response is 20–40% larger than the same data minified — the sample on this page shrinks from 130 bytes to 102 bytes (22% saved), and a realistic indented user-and-orders response shrinks from 335 bytes to 203 bytes (39% saved). That matters wherever bytes are metered or capped: API request and response bodies on slow networks, values stored in localStorage, JSON embedded in an HTML page, and configuration shipped to a device. Minifying is also the cheapest optimisation you can make — no code change, no dependency, no risk to the data — and doing it offline means production payloads with tokens and customer records never leave your browser.
When should you use this tool?
Use it when JSON is headed for the wire or into a size-limited store: minify an API request body before sending it, shrink a config blob before saving it to localStorage, compact JSON you are embedding in an HTML page or a URL parameter, or trim a fixture before pasting it into a chat message or a ticket. Do not minify JSON humans need to read or edit — keep the pretty version in your repository and minify only the copy you ship. And use the Formatter or the Viewer when you need to read a minified document again: minification is fully reversible, one click in either direction.
Key Benefits
- Lossless by construction: only insignificant whitespace is removed — every key, value, and string is preserved byte-for-byte, including whitespace inside quoted strings.
- Real savings: 20–40% on typical indented JSON, measured on this page's own examples (22% on the sample, 39% on a realistic API response).
- 100% private: parsing runs in browser memory; no upload, no logs, no tracking.
- Fully reversible: paste minified JSON into the JSON Formatter or JSON Viewer and the readable form comes straight back.
- Copy or download: one click copies the compact JSON, another saves it as minified.json.
- Zero setup: no install, no account, no build step — paste, click, copy.
Common Use Cases
- Shrinking API payloads: minify a request body before sending it over a slow or metered connection, where every byte is latency.
- Fitting localStorage: browsers typically cap localStorage around 5 MB per origin — minifying a stored blob buys real headroom before you hit the limit.
- Embedding JSON in HTML: a config object inlined in a page adds its whitespace to every page load; minified, it costs a third less.
- Pasting JSON into tickets and chats: a single-line payload is easier to share and cannot be mangled by a chat client re-flowing line breaks.
- Preparing fixtures for transport: minify a captured production payload before sending it to a colleague or a support channel, then format it back on arrival.
Developer Notes & Best Practices
Minifying is a parse-and-reserialise round trip: JSON.parse reads the document, JSON.stringify writes it back with no indentation argument. Only whitespace outside strings is removed — a space inside "Ada Lovelace" is data and survives untouched. Savings scale with how heavily indented the input was: the sample on this page (2-space indent) goes from 130 bytes to 102 bytes, a 22% saving, while a more deeply nested indented response goes from 335 bytes to 203 bytes, a 39% saving. The output is a single line, and it ends with no trailing newline. Two JavaScript behaviours carry over from every JSON parser: integer-like keys ("10", "2") are listed first in numeric order, and numbers above 2⁵³ lose precision — minifying does not cause either, it only reveals what the parse already did. Note that this page does not display a byte counter: measure the saving yourself by comparing the input and output lengths, or use the sizes quoted here, which were measured on the examples on this page.
Measured savings on this page's own examples
| Example | Pretty-printed | Minified | Saved |
|---|---|---|---|
| Sample on this page | 130 bytes | 102 bytes | 28 bytes (22%) |
| User-and-orders API response | 335 bytes | 203 bytes | 132 bytes (39%) |
| Already-minified JSON | Same size | Same size | 0 bytes — nothing left to remove |
| Deeply nested, 4-space indent | Largest saving | Smallest output | Savings grow with indent depth and nesting |
Minify vs format — which JSON tool do you need?
| Tool | Question it answers | Output |
|---|---|---|
| Minifier | “Make this as small as possible” | Single-line JSON, values unchanged |
| Formatter | “Make this readable, and tell me if it's broken” | Indented JSON + error location |
| Validator | “Is this valid, yes or no?” | Verdict + error location |
| Viewer | “Let me explore this big response” | Collapsible syntax-coloured tree |
- Keep the pretty version in your repository and minify only the copy you ship — a minified config checked into git is unreadable in a diff and uneditable in a review.
- Validate before minifying: minifying invalid JSON fails with the same parse error the Formatter would show, so fix syntax first and minify second.
- Round-trip check anything critical: paste the minified output into the JSON Formatter and confirm it re-indents to the document you started with.
- For multi-megabyte files, use jq on the command line (jq -c . file.json) instead of pasting into any browser tool — a browser tab is the wrong place for a 50 MB payload.
- Remember minifying is not compression: gzip or Brotli on top of minified JSON still shrinks it further, and the two stack — minify for the wire, compress for the transport.
Common Mistakes
- Minifying the only copy: once the pretty version is gone, the readable form only comes back through the Formatter — keep the original in your repo and minify a copy.
- Expecting minification to shorten keys or values: {"customer_name": "Ada Lovelace"} minifies to the same keys and values, just without the spaces — renaming fields is a different job.
- Thinking minified means compressed: minifying removes whitespace; gzip removes repetition. A minified 100 KB payload gzips smaller than a pretty 140 KB one, but minifying alone is not a substitute for compression.
- Minifying JSON to “fix” it: a syntax error fails the parse before any minifying happens — trailing commas and single quotes must be fixed first, and the Formatter's error pointer names the exact line.
- Pasting minified JSON into a config file a human edits: the next person to open it gets one 40 KB line. Minify at the boundary (before sending or storing), not at the source.
- Assuming the output has no trailing newline or a specific size: the output is a single line with no trailing newline, and this page shows no byte count — measure it yourself if the size matters.
Limitations
This page does not display a byte counter or a before/after size — you have to compare input and output lengths yourself (the measured examples in the table above are the honest reference). There is no file upload: paste the JSON rather than dropping a .json file. Conversion runs on click — click “Minify JSON”; the output does not update as you type. Minifying shortens nothing but whitespace: it does not shorten keys, drop unused fields, or deduplicate anything, so a document that is large because of its data stays large. Duplicate keys are resolved by the parse (the last value wins) before minifying. Numbers above 2⁵³ lose precision, as in every JSON parser, and extremely large pastes can briefly freeze the tab.
Structured Input/Output Example
{
"user": {
"id": 90412,
"name": "Ada Lovelace",
"email": "ada@example.com",
"roles": [
"admin",
"editor"
],
"active": true
},
"orders": [
{
"id": "ORD-1",
"total": 14280,
"paid": true
},
{
"id": "ORD-2",
"total": 4480,
"paid": false
}
]
}{"user":{"id":90412,"name":"Ada Lovelace","email":"ada@example.com","roles":["admin","editor"],"active":true},"orders":[{"id":"ORD-1","total":14280,"paid":true},{"id":"ORD-2","total":4480,"paid":false}]}Related Tools
JSON Formatter
JSON formatter: turn minified or messy JSON into readable, indented output. 2 spaces, 4 spaces, or tabs — paste, click Format, copy or download.
JSON Validator
JSON validator: paste JSON and click Validate for a verdict — valid or broken, with the line and column of the first syntax error. Strict RFC 8259.
JSON Viewer
JSON viewer for inspecting API responses as a collapsible, syntax-colored tree. Expand the branches you need, collapse the rest — free, 100% offline.