← Home

JSON Formatter

Format JSON with indentation and line breaks so nested data is readable, or minify it to a single line to cut payload size. Both run JSON.parse() first, so a missing comma or an unclosed bracket gives you a clear error message instead of broken output.

Input JSON
Options

Format vs. Minify

Format (also called "pretty-print") adds indentation and line breaks so nested JSON is easy to read. Minify does the opposite — it strips all whitespace to produce the smallest possible one-line output, which is useful when you want to reduce payload size. Both first validate your JSON with JSON.parse(), so if there's a syntax error (a missing comma, an unclosed bracket, etc.) you'll see a clear error message instead of broken output.

How to Format / Minify JSON

  1. Paste JSON — put the JSON you want to format or minify into the "Input JSON" box.
  2. Choose indentation — pick 2 spaces, 4 spaces, or a tab to use when formatting.
  3. Run it — click the "Format" or "Minify" button and the result appears below.
  4. Copy — use the "Copy" button to put the result on your clipboard.

How do I choose the indentation?

Pick whatever suits the readability and conventions of your formatted output. 2 spaces is the most common in the JavaScript and web ecosystem and saves horizontal space, so it's widely used. 4 spaces shows deeply nested structures more clearly, and a tab lets each editor adjust the width freely. Indentation only affects formatting; it isn't applied to minified output.

What happens if there's a syntax error?

Both Format and Minify first validate with JSON.parse(), so if something is wrong — a missing comma, an unclosed bracket, or single quotes — you'll see an error message instead of broken output. Use the message to fix your input and run it again. If you only want to quickly check validity, the JSON Validator is more convenient.

When would I use this?

Handy when debugging an API response that came back as a single unreadable line, cleaning up a config file, or shrinking JSON before sending it over the network. If you just need to check whether JSON is valid without reformatting it, try the JSON Validator instead. Everything runs directly in your browser — your JSON is never uploaded to a server.

Is my JSON private?

Yes. Formatting, minifying, and validation all run entirely inside your browser, and the JSON you enter is never sent to or stored on any server. That means you can safely paste and tidy up responses containing API keys or personal information.