Turn compact or messy JSON into clean, indented, readable output. Choose 2, 4, 8-space or tab indentation, optionally sort keys, validate, and minify — with light recovery of trailing commas. Runs entirely in your browser.
No installation, no signup. Results in milliseconds.
Common conventions and when each fits.
| Indent | Best for | Notes |
|---|---|---|
| 2 spaces | Most projects, config files | Compact, the npm/JS default |
| 4 spaces | Deeply nested data | Easier to scan levels |
| 8 spaces | Presentations, teaching | Very clear, larger files |
| Tab | Team-flexible width | Each viewer sets their own |
Pretty printing reformats JSON with consistent indentation and line breaks so it is easy for humans to read. Minified JSON saves bytes for machines; pretty-printed JSON is for people — reviewing, debugging, and documenting.
Pretty print adds whitespace for readability; minify removes it for size. Neither changes the data — only its presentation.
Pretty printing only changes whitespace — but which whitespace matters for readability, diffs, and file size. This tool supports 2, 4, 8 spaces, or tabs.
| Indent | Best for | Trade-off |
|---|---|---|
| 2 spaces | The most common convention; config files, npm, most style guides | Deep nesting can be harder to scan |
| 4 spaces | Deeply nested data where each level needs to stand out | Wider lines, larger files |
| 8 spaces | Presentations and printouts that need obvious structure | Very wide; rarely used in code |
| Tab | Teams that let each developer pick their own display width | Renders differently across editors |
Pretty printing adds line breaks and indentation so humans can read the data; minifying strips all of it so machines can transfer it faster. They are exact opposites and lossless — the keys, values, types, and order never change, only the whitespace. Use pretty print while developing and debugging; minify before shipping to production.
Enabling Sort keys reorders every object’s keys alphabetically. This is invaluable for comparing two JSON files or producing stable diffs in version control, because the same data always serializes in the same order. It is a display convenience — JSON objects are unordered by specification, so sorting never changes meaning. Need to reorder without formatting? Use the dedicated JSON Sorter.
Real-world JSON often arrives with trailing commas copied from JavaScript. This tool applies a light cleanup that removes common trailing commas before formatting, so nearly-valid input still pretties up. Genuinely invalid JSON returns a clear error instead — paste it into the JSON Parser to pinpoint the exact failure.
See how pretty printing turns a minified one-liner into a clean, indented layout.
Paste a compact one-liner and the pretty printer adds consistent line breaks and indentation so the structure is obvious at a glance. Nothing but whitespace changes — the keys, values, and order are identical, so the output parses to exactly the same data as the input.
Pick 2 spaces, 4 spaces, 8 spaces, or tabs to match your project’s style. When you are ready to ship the JSON, run it through the JSON minifier to strip the whitespace back out for production. If formatting fails, the input is not valid JSON — the JSON parser will point to the problem.
Readable JSON helps everywhere people read data.
Everything developers ask about pretty printing JSON.
Hands-on articles from our blog.
All free, all browser-based, no signup required.