JSON Formatter
Beautify, minify and sort JSON with your choice of indentation — instantly, in your browser.
Runs in your browser — your data never leaves your device.
About the JSON Formatter
API responses and config files are often a single unreadable line of JSON. Paste it here and get clean, indented JSON in one click — or do the opposite and minify it to the smallest size.
If the JSON is invalid, the formatter tells you exactly which line and column has the problem. Everything happens in your browser, so private API data never leaves your computer.
How to use the JSON Formatter
- Paste your JSON, or click Open file to load a .json file.
- Choose the indent (2 spaces, 4 spaces or tab) and optionally Sort keys.
- Click Format / Beautify (or press Ctrl + Enter), or Minify to compress.
- Copy or Download the result.
How it works
The formatter parses your text with the browser's standard JSON parser (the same one websites use) and writes it back out with consistent indentation. Minify writes it without any spaces or line breaks. Sorting keys orders object keys alphabetically at every level, which makes two JSON files easier to compare.
Examples
- Input:
{"name":"WE Tools","tools":["json","base64"]}(one line, 45 characters) - Formatted with 2 spaces, every key and array item gets its own line, indented two spaces per level — 7 lines that are easy to read.
- Minified, the same data goes back to a single line with no spaces, the smallest size for sending over the network.
Frequently asked questions
Is my JSON sent to a server?
No. Formatting and validation happen entirely in your browser. You can even use the tool offline once the page has loaded.
Why does it say my JSON is invalid?
Common causes are single quotes instead of double quotes, a trailing comma after the last item, missing quotes around keys, or comments (JSON does not allow comments). The error message points to the exact line.
Can it format very large files?
Yes, files of several megabytes work fine on most computers. Very large files depend on your device memory.