JSON Formatter
Format, beautify, or minify JSON instantly — with live validation, exact error positions, copy and download. Runs entirely in your browser; nothing is stored.
Calculator
Output
Result
—
How JSON Formatter Works
What is a JSON Formatter?
A JSON formatter takes raw, minified, or messy JSON and rewrites it with consistent indentation so humans can actually read it. JSON (JavaScript Object Notation) is the standard data format for web APIs, configuration files, and log payloads — but servers usually emit it as a single unbroken line. This tool formats (“pretty-prints”) JSON with 2 or 4 spaces of indentation, or does the reverse: minifies formatted JSON down to its smallest form for production payloads.
Everything runs instantly in your browser as you type — your JSON is never stored. Invalid input is caught live, with the exact line and column of the first syntax error.
Format vs Minify
| Format (beautify) | Minify | |
|---|---|---|
| Purpose | Reading, debugging, code review | Production payloads, storage |
| Whitespace | Indented, one value per line | None — single line |
| Size | Larger (whitespace) | Smallest valid form |
| Validity | Identical data — whitespace never changes JSON semantics | |
Common JSON Syntax Errors
- Trailing commas —
{"a": 1,}is invalid JSON (unlike JavaScript). - Single quotes — strings and keys must use double quotes:
{'a': 1}fails. - Unquoted keys —
{a: 1}is a JavaScript object literal, not JSON. - Comments — JSON has no
//or/* */comments. - Special values —
NaN,Infinity, andundefineddo not exist in JSON; usenull.
The live validator flags each of these with its position as you type. For a dedicated syntax check with detailed diagnostics, use the JSON Validator.
Privacy
Formatting runs in your browser via JavaScript — pasted JSON is not sent anywhere or stored. If you submit the form with JavaScript disabled, the server processes the text transiently to return the result and does not retain it. Either way, nothing you paste is logged or saved.
Limits
Input is capped at 1 MB — comfortably above typical API responses and configuration
files. For larger files, format locally with python -m json.tool or jq.
Accuracy & Sources
Last reviewed: July 2026. Formula source: ECMA-404 / RFC 8259 — The JSON Data Interchange Format. All calculations run in your browser. No data is sent to any server.
Frequently Asked Questions
Paste your JSON into the input box and click Format. The tool re-indents it with 2 or 4 spaces (your choice) and shows size, key count, and validity instantly. Click Minify instead to strip all whitespace for production use. Copy the result with one click or download it as a .json file.
No. Formatting runs entirely in your browser with JavaScript — the text never leaves your machine while you type. Only if JavaScript is disabled does the form fall back to a server round-trip, and even then the input is processed transiently and never stored or logged.
The five most common causes: a trailing comma before } or ], single quotes instead of double quotes, unquoted keys, comments (JSON does not allow them), or JavaScript-only values like undefined and NaN. This tool reports the exact line and column of the first error so you can jump straight to it.
They are inverse operations on whitespace only. Formatting adds indentation and line breaks so humans can read the structure; minifying removes every optional space and newline to make the payload as small as possible for transmission. The data itself is identical in both forms — whitespace has no meaning in JSON.
Both are valid; it is purely a readability convention. 2 spaces is the most common choice in the JavaScript/Node ecosystem and keeps deeply nested structures compact. 4 spaces matches Python conventions and reads more clearly for shallow documents. Follow whatever your project's existing files use.
Marginally — minifying typically saves 10–30% of payload bytes, but gzip or brotli compression (which virtually every server applies) already collapses whitespace almost for free. Minify for consistency and marginal gains, but enable HTTP compression first; it matters far more.
1 MB of input text, which covers the vast majority of API responses and config files. Beyond that, browser-based formatting becomes sluggish, so the limit keeps the tool instant. For bigger files, use command-line tools: python -m json.tool file.json, or jq '.' file.json for streaming-friendly formatting.