ToolHub
{ }

JSON Formatter

Beautify, minify, validate and sort JSON.

About the JSON Formatter

Paste JSON and immediately get it beautified, minified, or with keys sorted alphabetically. Indentation can be 2 spaces, 4 spaces or tabs, and the page reports the total key count, maximum nesting depth and output size. Invalid input produces the exact parser error so you can find the offending character fast.

How to use the JSON Formatter

  1. Paste your JSON into the input area.
  2. Choose an indentation style: 2 spaces, 4 spaces or tabs.
  3. Tick Sort keys alphabetically to normalize key order, or Minify to strip all whitespace.
  4. Read the Keys, Max depth and Size stats, then copy the result or download it as a .json file.

JSON Formatter FAQ

Is my JSON validated too?

Yes. The input is parsed before formatting, and any syntax error is shown with the parser message, including the position where parsing stopped.

What does sorting keys change?

It recursively sorts every object's keys alphabetically, including keys inside nested objects and arrays, which makes diffs between similar files far easier to read.

How large can my JSON be?

There is no artificial limit โ€” formatting runs in your browser, so typical configuration files and API payloads handle instantly; multi-megabyte files just take a moment longer.