JSON Minifier
Minify JSON instantly, with validation as you type.
About the JSON Minifier
What is a JSON minifier?
A JSON minifier strips every byte that machines don't need — indentation, line breaks, and the spaces after colons and commas — and leaves a single compact line that parses exactly the same. On a typical pretty-printed API response that's a 25–40% size cut before compression even enters the picture, which matters for payloads you store in databases, ship to mobile clients, or paste into config fields with size limits.
This one validates while it minifies. The badge above the editor tells you the moment your JSON stops parsing, with the exact line and column of the problem, so you never copy a compacted blob only to discover a trailing comma broke it. It also preserves your numbers exactly as written — long integer IDs beyond JavaScript's safe range come out byte-for-byte identical instead of silently rounding, something most online minifiers get wrong. Everything runs in your browser; nothing is uploaded.
How to Use This Tool
- Add your JSON. Paste it into the left editor, click Open file, or hit Sample to try it.
- Read the badge. Green means valid; red gives you the line and column of the first error.
- Adjust if needed. Flip Sort keys for a canonical key order, or switch the mode to Beautify to go the other way.
- Take the result. Copy it or download
data.min.json. The chips show the exact size reduction.
Common Use Cases
- Shrinking API payloads: Compact response fixtures and request bodies before committing them or embedding them in tests.
- Config fields with limits: Fit JSON into environment variables, CMS fields, or query parameters that count characters.
- Canonical diffs: Minify with sorted keys to produce a stable, comparable representation of two documents.
- Cleaning exports: Compact bulky pretty-printed exports from tools and dashboards before archiving them.
Need the opposite direction? The JSON Formatter expands and validates, the JSON Sorter reorders keys, and the JSON Compare tool diffs two documents semantically. Or browse all our free developer tools.
Frequently Asked Questions
Does minifying change my data?
No. Minification only removes whitespace between tokens. Strings keep their internal spacing and escapes, and numbers are re-emitted exactly as you wrote them, so the parsed result is identical.
Are big integer IDs safe?
Yes. In modern browsers the tool preserves number literals verbatim, so a large database ID like 9007199254740993 survives untouched instead of being rounded to the nearest floating-point value — a subtle corruption many JSON tools introduce.
How much smaller will my JSON get?
It depends on how it was formatted. Four-space pretty-printed JSON typically shrinks 25–40%. The size chips above the output show the before and after byte counts for your exact input.
Can it handle JSON with comments or trailing commas?
No — those aren't part of the JSON specification, so the validator flags them with the exact position. That's deliberate: output from this tool is guaranteed to parse in every strict JSON parser.
What does Sort keys do?
It recursively sorts every object's keys alphabetically before minifying. Two documents with the same data but different key order then minify to the same string, which makes comparisons and cache keys reliable.
Is my JSON uploaded anywhere?
No. Parsing and minification run entirely in your browser with self-contained JavaScript — no CDN, no server round trips, no logging. It even works offline once the page has loaded.