JSON Formatter

Format, validate and minify JSON in your browser. Paste or drop a file, pick 1–16 spaces or tabs, and get readable JSON without changing any number values. Large integers, decimals like 1.0, key order and duplicate keys are kept exactly as written.

About this tool

What is a JSON formatter?

A JSON formatter (also called a JSON beautifier or pretty printer) rewrites JSON with line breaks and indentation so its structure is easy to read. This tool also checks that the input is valid JSON and can do the reverse: minify it into a single line.

How to use

  1. Paste JSON into the editor, or drag and drop a .json file onto it.
  2. Under Indent, choose Spaces and enter the width (1–16), or choose Tab.
  3. Click Format to pretty-print, or Minify to remove all whitespace.
  4. Use the Copy to clipboard or Download button in the editor corner to take the result (downloads are saved as format.json).

If the input is not valid JSON, the error message from the parser is shown below the editor and the text is left unchanged.

Features

  • Format and minify in place with one click
  • Validation: input is checked with the browser's JSON parser before anything is changed
  • Lossless numbers: values are copied from your input, so 12345678901234567890 or 1.0 are not rounded or rewritten
  • Original order: key order and duplicate keys are kept as they are
  • Compact empty values: {} and [] stay on one line
  • Byte size of the current text is shown under the editor
  • Syntax highlighting and a fullscreen editor
  • A leading byte order mark (BOM) is removed automatically

Example

Input:

Output with 2 spaces:

FAQ

Is my JSON sent to a server?

No. Formatting and validation run entirely in your browser, and the text is never uploaded.

Why do other formatters change my numbers?

Many tools parse JSON into JavaScript numbers and print them again, which rounds integers larger than 2^53 and turns 1.0 into 1. This formatter only re-indents the original text, so number literals stay exactly as written.

Does it accept comments or trailing commas (JSON5 / JSONC)?

No. Only standard JSON is accepted; comments, single quotes and trailing commas are reported as errors.

What does Minify do?

It removes all spaces and line breaks outside of strings, producing the smallest valid JSON on a single line.