JSON Minifier
Remove whitespace, line breaks and comments from JSON to make the smallest valid file, with size savings shown.
This guide is not yet available in your language and is shown in English.
Tool guide
What this tool does
JSON Minifier strips every insignificant space, tab and line break from JSON and can also remove comments and trailing commas from JSONC files. It shows the original and minified sizes, keeps number and string values unchanged, and can minify many files at once.
Pretty-printed JSON is pleasant to read but carries a lot of weight: indentation and line breaks can account for 20 to 40 percent of a file. When JSON is embedded in a web page, stored in a database column, sent over a slow mobile connection or pasted into an environment variable, that extra whitespace costs bandwidth, storage and sometimes hits length limits.
The minifier parses your JSON with a lossless parser and prints it back with no whitespace at all between tokens, so the result is the smallest valid representation of the same data. Whitespace inside strings is preserved because it is part of the value. With comment stripping turned on it also converts JSONC (JSON with comments) into strict JSON that any parser accepts. The work happens in your browser, and large files are handled with a short pause rather than a frozen tab.
How to use JSON Minifier
- Paste JSON into the JSON input box, open a file, or click Sample to load a commented configuration file.
- Keep “Strip comments and trailing commas” on for JSONC input, or turn it off to reject anything that is not strict JSON.
- Optionally sort keys, escape non-ASCII characters or add a final newline.
- Check Original size, Minified size and the Saved percentage under the output.
- Copy or download the minified JSON, or drop several files into “Convert several files” and download a ZIP.
Tips for better results
- For API traffic, gzip or Brotli compression on the server shrinks JSON far more than minification alone; combine both for the best result.
- Sorting keys before minifying produces identical bytes for identical data, which helps HTTP caching and checksums.
- Keep the pretty-printed version in source control and minify only the build output, so diffs stay readable.
- Escaping non-ASCII characters increases size slightly, so enable it only when a downstream system cannot handle UTF-8.
Common use cases
- Embedding a configuration object or structured data block in an HTML page.
- Shrinking large fixtures or GeoJSON layers before shipping them with a web app.
- Storing JSON in a database column, cookie or query string with a size limit.
- Turning a commented settings file into strict JSON for a tool that rejects comments.
Common mistakes to avoid
- Minifying the only copy of a hand-maintained file; comments are lost permanently, so keep the original.
- Expecting minification to remove unused data. It only removes whitespace; delete unneeded fields separately.
- Using a regular-expression whitespace stripper instead of a parser, which can corrupt spaces inside string values.
Frequently asked questions
Is minified JSON still valid JSON?
Yes. Whitespace between tokens is optional in the JSON grammar, so the minified file parses to exactly the same data as the original.
How much smaller will my file get?
It depends on how it was formatted. A file indented with four spaces and lots of nesting often shrinks by a third, while JSON that is already compact may only lose a few bytes.
Are comments removed?
With “Strip comments and trailing commas” enabled, both // line comments and /* block */ comments are removed, along with any trailing commas, producing strict JSON.
Does minifying change numbers like 1.50?
No. Numbers are copied exactly as written, so 1.50 stays 1.50 and long integers are not rounded. Only whitespace and comments are removed.
Related articles
Feedback & suggestions
Help us improve JSON Minifier. We read every message.