Online JSON Formatter — Prettify with Custom Indentation

Format minified or messy JSON with readable indentation, using 2 or 4 spaces or tabs. Formatting runs in your browser and nothing is uploaded.

Loading…
How the JSON formatter works
Turn minified or messy JSON into readable, indented output. Choose 2 or 4 spaces or tabs. Formatting runs in your browser and nothing is uploaded.

Format, beautify, or pretty-print JSON

A JSON formatter, a beautifier and a pretty-printer do the same job: re-indent minified or single-line JSON so people can read it. Paste a payload, pick two or four spaces or tabs, turn on Sort keys if you need it, then select Format. Pasting also formats right away. Everything runs in your browser and nothing is uploaded to FastMinify. The text is parsed before any output appears. Invalid JSON is not formatted: the results panel shows the error so you can fix it. For line and column hints while you edit, use the JSON validator. The output is rebuilt from the parsed values, so the data stays the same while the whitespace changes. To shrink a payload instead, use the JSON minifier.

Developer notes

The input is parsed first. Fix syntax errors here or in the JSON validator before formatting. Indent size and style apply on every Format run. Changing an option formats the current input again. Values are kept, but the output is written by JSON.stringify: 89.0 becomes 89, 1e3 becomes 1000, \u00e9 becomes é. Integers beyond 2^53 lose precision, and a duplicated key keeps only its last value. Integer-like keys ("2", "10") move to the top of their object, as in every JavaScript engine. To reduce size, use the JSON minifier. This page is about readability.

Formatting options

Indent size
Spaces per indentation level: 2 or 4. Ignored when the style is tabs.
Indent style
Use spaces or a tab character for each indentation level.
Sort keys
Off by default, so keys keep their order. When on, object keys are sorted at every depth for stable diffs, and arrays keep their order. More sorting options are in <a href="/en/json-sort">JSON Sort</a>.

When to use it

Read minified API logs or webhook payloads during an incident. Normalize fixtures before opening a pull request. Prepare readable snippets for documentation or a Slack thread. Check converter output before exporting it to YAML or CSV.

Worked examples

Minified log line

Sample input

{"order":{"id":"ord_8f2a","status":"paid","customer":{"id":"cus_42","name":"Ada Lovelace","email":"ada@example.com"},"line_items":[{"sku":"WB-001","qty":2,"price":24.99},{"sku":"WB-003","qty":1,"price":89.0}],"total":138.98}}

Formatted output

{ "order": { "id": "ord_8f2a", "status": "paid", "customer": { "id": "cus_42", "name": "Ada Lovelace", "email": "ada@example.com" }, "line_items": [ { "sku": "WB-001", "qty": 2, "price": 24.99 }, { "sku": "WB-003", "qty": 1, "price": 89 } ], "total": 138.98 } }

Small nested config

Sample input

{"metrics":{"cpu":"450m","memory":"512Mi","replicas":3}}

Formatted output

{ "metrics": { "cpu": "450m", "memory": "512Mi", "replicas": 3 } }

Related JSON tools

The JSON tools hub lists the whole family. Check syntax with the JSON validator, compare two versions in JSON diff, or browse keys in the JSON tree viewer. Shrink payloads with the JSON minifier or export through JSON → XML.

JSON formatter FAQ

Readable JSON, same data

Does formatting change values?

The parsed values stay the same, but the text is rewritten. Indentation changes, numbers take their shortest form (89.0 becomes 89) and \u escapes become plain characters.

Difference vs JSON minifier?

The minifier removes whitespace to shrink file size. This formatter adds indentation for human review.

Key order?

Keys keep the order in which they appear, except integer-like keys ("2", "10"), which JavaScript always moves to the top of their object. Sort keys orders every object alphabetically.

Server uploads?

No. Formatting runs in your browser and nothing is sent to FastMinify.

Can I sort keys?

Yes. The Sort keys switch sorts the keys of every object, at every depth, and leaves arrays in their order. For natural or numeric order, array sorting or a depth limit, use the JSON Sort tool.

How do I format JSON with 2 or 4 spaces?

In the options, set Indent to 2 spaces or 4 spaces, or set Style to tabs (one tab per level). The current input is formatted again as soon as you change an option.

What is the difference between a JSON formatter and a validator?

A formatter re-indents valid JSON so you can read it. A validator checks whether the text is valid JSON and shows where it breaks. Use the JSON validator to locate an error, then come back here to format.

Validate, format, repair, compare and explore JSON in your browser, alongside the JSON minifier and converters.