Skip to main content
FreeToolsHub

JSON Formatter & Validator

Paste JSON and get it neatly indented, or find out exactly where it is broken. Format it, minify it, sort its keys and download the result. Your data is only parsed as data and never leaves your device.

  • Free to use
  • No sign-up
  • Runs in your browser

Your code is only treated as text. It is never run, rendered or sent anywhere. Limit: 2,000,000 characters.

Indentation

Good to know

Your JSON is only parsed as data, never run as code, and is not sent to any server. Numbers with more than 15 digits cannot be stored exactly by JavaScript, so keep such IDs as strings.

How to use the JSON Formatter & Validator

  1. Step 1: Paste your JSON into the input box, or press Load example.

  2. Step 2: Choose an indentation: 2 spaces, 4 spaces or a tab. Tick Sort keys A to Z if you want keys in alphabetical order.

  3. Step 3: Press Format JSON. Or press Minify instead for the smallest single-line version.

  4. Step 4: If the JSON is invalid, read the line and column in the message and fix that spot.

  5. Step 5: Press Copy output, or Download to save a .json file.

Features and benefits

  • Exact error locations

    A strict checker reports the line and column of the first problem, with a plain explanation.

  • Format or minify

    Readable indentation for people, or the smallest form for machines.

  • Sort keys

    Put object keys in alphabetical order at every level, handy for comparing files.

  • Catches common mistakes

    Trailing commas, single quotes, unquoted keys and missing brackets are named explicitly.

  • Private

    Parsing happens in your browser. Your data is not uploaded or stored.

What counts as valid JSON

JSON is stricter than JavaScript object syntax. Keys and strings must use double quotes, there can be no comments, and no comma may follow the last item of an object or array. Values can be strings, numbers, objects, arrays, true, false or null, and nothing else. This tool checks against those rules and tells you the first thing that breaks them.

Limits to know about

Formatting parses the JSON and writes it back out, so formatting differences such as the original spacing are not kept. If an object has the same key twice, only the last one survives, as in any JSON parser. JavaScript stores numbers as 64-bit floating point, so integers beyond about 15 digits may be rounded; the tool warns you when it sees one. Inputs up to two million characters are accepted.

Example use cases

  • Reading API responses

    Make a compressed one-line response easy to read.

  • Fixing config files

    Find the missing comma or bracket in a settings or package file.

  • Comparing data

    Sort keys and format two files so differences are easy to see.

  • Shrinking payloads

    Minify JSON before storing or sending it.

Frequently asked questions

Is my JSON sent to a server?

No. It is parsed and formatted in your browser and is never uploaded.

Why does it say my JSON is invalid?

Usually a trailing comma, single quotes, an unquoted key or a missing bracket. The message gives the line and column of the first problem.

Does it support comments in JSON?

No. Standard JSON has no comments. Remove them before formatting.

Why did a long number change?

JavaScript cannot store integers above about 15 digits exactly. Keep large IDs as strings in your data.

What does sorting keys do?

It puts the keys of every object in alphabetical order. Arrays keep their order.

Last updated 10 November 2026.