JSON Formatter — Free Online Pretty-Print, Minify & Diff
Format and validate JSON instantly. Pretty-print with 2/4/tab indent, minify for transmission, or diff two JSON blobs side-by-side. Everything runs in your browser — your data stays local.
How to format and validate JSON online
- Paste your JSON. Paste raw JSON into the left editor, or drag a .json file into the editor area. Up to 10 MB works smoothly.
- Pick indent style. Choose 2 spaces, 4 spaces, or tab indentation. The formatted output appears live in the right pane.
- Validate. Invalid JSON shows the exact line and column of the error in red, with a one-line explanation of what went wrong.
- Copy, minify, or diff. Copy formatted output, switch to minify mode (single-line output for transmission), or load a second blob into the diff view.
Frequently Asked Questions
- Is my JSON uploaded or logged?
- No. Formatting, validation, and diff run entirely in your browser. Nothing is sent to a server.
- What is the maximum file size?
- Up to ~10 MB performs smoothly. Larger files may slow the editor. For >50 MB consider a CLI tool like jq.
- Does it sort keys alphabetically?
- Yes — toggle the "Sort keys" option to alphabetize object keys recursively. Useful for stable diffs.
- Can it handle JSON5 or JSONC (with comments)?
- Yes — toggle the "Allow comments" option. Output is valid JSON (comments stripped).
- How does the diff view work?
- Load JSON A and JSON B. Differences are highlighted line-by-line. Added keys appear green, removed red, changed yellow.
- Will it preserve number precision?
- JavaScript number precision (53-bit) is preserved. For larger integers (BigInt), use a CLI tool.
Use Cases
- Debug API responses by pretty-printing raw JSON
- Minify JSON config before embedding in HTML or environment variables
- Diff two JSON snapshots to find what changed between deploys
- Validate JSON syntax before pasting into a config file
- Sort object keys alphabetically for stable git diffs