JSON Minifier & Formatter

Minify JSON for APIs, config files, and payloads — removes all whitespace to produce the smallest valid JSON. Or prettify compact JSON back to readable, indented form. Runs entirely in your browser.

JSONInput
Lines: 0 Size: 0 B Ctrl+Enter to process
JSONMinified
Output will appear here after processing…
Lines: Size:

JSON Minifier & Formatter — Complete Guide

JSON minification removes all whitespace — spaces, tabs, and newlines — that exists only for human readability. The resulting JSON is semantically identical: every key, value, and nested structure is preserved exactly. Minified JSON is smaller on the wire, faster to parse, and ideal for API payloads, config files, and local storage.

⚡ Minification

Removes all non-essential whitespace to produce the smallest valid JSON string.

✅ Validation

Validates JSON syntax before processing — reports the exact line and position of any parse error.

✦ Prettifier

Beautify minified JSON to readable, indented form with your chosen indent size.

📊 Size Stats

See the original vs. compressed size and percentage saved with every run.

How Much Does JSON Minification Save?

JSON whitespace can account for 20–50% of file size depending on nesting depth and formatting style. A deeply-indented 4-space config file minifies dramatically. Combined with gzip, total savings typically reach 60–80% — making minification especially worthwhile for large API responses and bundled data files.

When to Use JSON Minification

Use JSON minification for API payloads where every byte counts, config files embedded in HTML or served over slow networks, and JSON data files bundled into web apps. For development, keep the prettified version in source control and minify as part of your build step.

Frequently Asked Questions

Will minification break my JSON?

No. JSON minification only removes whitespace (spaces, tabs, newlines) that exists outside of string values. All keys, values, nesting, and data types are preserved exactly. The output is 100% valid JSON that parses identically to the original.

Can I minify JSON with comments?

Standard JSON (RFC 8259) does not allow comments. If your file contains // comments or /* block comments */, it is JSONC (JSON with Comments) — used by VS Code configs and some build tools. This tool will attempt to strip comments before parsing; standard JSON parsers will reject JSONC files.

Is my JSON sent to a server?

No. All processing happens entirely in your browser using JSON.parse() and JSON.stringify(). Your data never leaves your machine — important for JSON files containing credentials, API keys, or sensitive config values.

What is the difference between minify and stringify?

This tool uses JSON.parse(input) followed by JSON.stringify(parsed) (no spacing argument) to produce minified output. This also normalises the JSON — trailing commas, duplicate keys, and non-standard values are rejected with a clear error message.

Tool last updated: