JSON Minifier
Shrink JSON for production by stripping whitespace, comments, and trailing commas — right in your browser. Paste or upload data and get a compact, byte-saving version instantly.
100% Client-Side Processing
Your JSON is parsed and minified entirely in your browser. Nothing is uploaded to a server.
Table of Contents
What is a JSON Minifier?
A JSON minifier removes every byte a parser doesn't need — indentation, line breaks, and spaces around punctuation — so the same data ships in far fewer bytes. It's the fastest way to shrink config files, API payloads, or any JSON you serve directly to a client.
This tool also understands the two most common ways "JSON" files stray from the strict spec: // and /* */ comments, and trailing commas before a closing } or ]. Turn on "Strip comments and trailing commas" to clean those up automatically before parsing, so JSONC-style config files minify into valid, strict JSON.
How it Works
- Add your JSON: Paste JSON directly into the editor, or upload a .json file.
- Choose your options: Toggle comment/trailing-comma stripping for JSONC-style input, and sort keys alphabetically if you want deterministic output.
- Review instantly: Your minified JSON and size-reduction stats update as you type.
- Copy or download: Copy the result to your clipboard or download it as a .json file.
Features
- Paste JSON or upload a .json file
- Instant minification that strips all whitespace and line breaks
- Optional stripping of // and /* */ comments and trailing commas (JSONC/JSON5-style input)
- Optional alphabetical key sorting for deterministic, diff-friendly output
- Clear, specific error messages when JSON is invalid
- Output size and size-reduction percentage stats
- Copy to clipboard or download as .json
- 100% client-side processing for privacy
Best Practices
- Minify only your shipped output: keep a readable, formatted source file and minify as a build step, not the file you edit day to day.
- Sort keys when you need stable diffs: turn on alphabetical key sorting for generated config or lock-style files so re-running the export doesn't produce noisy, reordered diffs.
- Strip comments before shipping to strict parsers: most production JSON.parse calls reject comments and trailing commas — clean up JSONC-style config before it reaches a strict consumer.
- Validate before you minify: fix underlying syntax errors first — minifying can't repair broken JSON, only compact valid JSON.
- Pair it with gzip or brotli: server-side compression handles repeated structure well, while minifying removes the human-readable padding compression can't always reach.
Troubleshooting
My JSON has comments and won't parse
Standard JSON doesn't support // or /* */ comments. Turn on "Strip comments and trailing commas" to remove them automatically before parsing.
Minified output looks like one long line
That's expected — minifying removes all indentation and line breaks between tokens to save bytes. The data itself is unchanged.
Key order changed after minifying
Order is preserved by default. It only changes if you've turned on "Sort object keys alphabetically," which reorders keys in every object, including nested ones.
I need to read or edit my JSON, not shrink it
This tool is minify-only. For clean, indented JSON you can actually read and edit, use the JSON Formatter, which supports both beautify and minify modes.
Common Use Cases
- Shrinking API response payloads: minify JSON fixtures or mock responses to reduce transfer size and speed up requests.
- Embedding JSON literals in HTML or JS bundles: a compact inline data blob adds less weight to the surrounding page or script.
- Reducing localStorage or sessionStorage footprint: browser storage has size limits — minified JSON leaves more room before you hit them.
- Cleaning up JSONC-style config before deployment: strip the comments and trailing commas developers rely on for readability so strict production parsers accept the file.
- Shrinking JSON for space-constrained fields: fit data into URL query parameters, environment variables, or database columns with tight size limits.
Frequently Asked Questions
No. Minifying only removes whitespace, line breaks, and — if enabled — comments and trailing commas. The values and structure stay identical.
They're only removed if you enable "Strip comments and trailing commas." Standard JSON doesn't support comments, so leaving them in without stripping will cause a parse error.
No. The strip option handles the two most common non-standard extras (comments and trailing commas), but it can't repair other syntax errors — the error message tells you what's wrong so you can fix it.
Yes. When enabled, sorting is applied recursively to every object in the structure, no matter how deeply nested.
No, this tool only minifies. If you need indented, readable JSON, use the JSON Formatter, which supports both beautify and minify modes.
No. Everything happens locally in your browser, and nothing is uploaded or saved.
It runs entirely in your browser, so the practical limit is your device's available memory — typical config files and API payloads work instantly.