CODING & JSON · BFOTKIT

JSON formatter and minifier online.

Pretty-print JSON with your preferred indentation, minify it for transport, and optionally sort keys alphabetically — with correct error reporting when the input is not valid JSON.

Formatted JSON

Formatting happens entirely in this browser tab. Nothing is sent to a server.

GUIDE

How to format JSON

Paste and choose a style

Pretty printing adds indentation and line breaks so nested structures become readable, which is what you want for config files, code review, and debugging. Minifying removes all insignificant whitespace, producing a single line that is smaller to transmit or embed. Switch styles freely; the input is never modified.

Pick the indentation that matches your project

Two spaces is the JSON convention and matches most linters; four spaces suits teams whose code style uses them; tabs let each reader configure their display width. Match your project rather than your preference, since mixed indentation in a repository is a review distraction.

Sorting keys helps comparisons

The sort option alphabetizes object keys at every level. That makes two JSON documents diff cleanly when they contain the same data in different orders — useful when comparing API responses across environments. Do not sort when key order carries meaning for a consumer, such as some APIs that echo insertion order.

Read the errors precisely

When the input is not valid JSON, the tool reports the parser’s message with the position in the text. Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, and comments, none of which are allowed in JSON. Fix the first reported error and re-run; later errors often disappear once the structure is valid.

HELP / FAQ

JSON formatter questions

Does formatting change my data?

No. Only whitespace and, if you enable it, key order change. Numbers, strings, arrays, and nesting are preserved exactly; the parsed value is re-serialized, so equivalent representations like 1e2 may be normalized to 200.

Is my JSON uploaded anywhere?

No. Parsing and formatting run in this browser tab, and the download is generated locally. The tool also works offline after the page loads.

Can it handle large files?

Moderate sizes work fine — the limit is your device memory, not a quota. Files of many megabytes may take a moment to parse and render; minified output is usually smaller than the input.

Why does my JSON with comments fail?

JSON has no comment syntax. Comments come from JavaScript or configuration dialects such as JSON5; strip them before formatting, or keep such files in their native format instead of strict JSON.

EXPLORE BY CATEGORY · BFOTKIT

More tools like this

Pick a category to see every tool in it — then open one and discover related tools.

Browse all tools