Developer
JSON formatter
Beautify or minify JSON with 2-space, 4-space, or tab indentation.
Free to use · Runs in your browser · No signup
This tool works in your browser. Enable JavaScript to select files and create your download.
How to use JSON formatter
- Paste your JSON.
- Choose the indentation, or Minify for a single line, and optionally sort keys.
- Copy or download the formatted JSON.
What you need
Nothing to upload. Type or paste directly into the tool; results update as you go.
Your result
Formatted or minified JSON.
Before you start
Invalid JSON shows the problem and its line and column. Very large numbers lose precision beyond what JavaScript can represent exactly.
What it does
- Pretty-prints JSON with 2 spaces, 4 spaces, or tabs, or minifies it onto one line.
- Sorts object keys alphabetically at every level, which makes two files easier to compare.
- Points to the line and column of the first syntax error.
Common errors and fixes
- Trailing commas, like {"a":1,}, aren’t allowed in JSON. Remove the last comma.
- Comments (// or /* */) aren’t part of JSON. Remove them, or the parser stops at the first one.
- Property names and strings need double quotes, not single quotes.
- Duplicate keys are accepted, but only the last value is kept. Check that nothing important was overwritten.
Example
Input: {"b":1,"a":{"d":2,"c":3}}
Formatted with sorted keys:
{
"a": {
"c": 3,
"d": 2
},
"b": 1
}Questions about JSON formatter
Why did a long number change?
JavaScript numbers are precise only up to 15–16 digits, so a value like 12345678901234567890 is rounded when parsed. Store IDs this long as strings.
Is my JSON sent to a server?
No. Parsing and formatting happen in your browser, so you can safely format API responses, configs, and data that contain private information.
Is what I type sent anywhere?
No. The calculation runs in your browser, and the text or numbers you enter are not uploaded or stored.
Is it free? Do I need an account?
Yes, it’s free, and there’s no account or signup. FreeToolBench is supported by ads.