JSON Formatter

Pretty-print or minify JSON with your choice of indentation and optional key sorting.

Runs in your browser — nothing you enter is sent to our servers

How it works

Your input is parsed with the browser’s standard JSON.parse, optionally re-ordered (sort keys), then written back with JSON.stringify using your chosen indentation — or with no whitespace at all for Minify. If parsing fails, you get the error and a link to the validator for a precise diagnosis. Press Ctrl/⌘ + Enter to re-run.

Minify here re-serialises the data, which tidies numbers (1.50 becomes 1.5). To keep every value exactly as written, or to strip comments from JSONC, use the JSON minifier.

Example

The minified input {"name":"ToolTarvern","free":true} formatted with 2 spaces becomes:

{
  "name": "ToolTarvern",
  "free": true
}

Frequently asked questions

Is my JSON sent to a server?

No. Formatting uses your browser’s built-in JSON engine. Your data stays on your device — important if it contains API keys or personal information.

What does “sort keys” do?

It orders object properties alphabetically at every level, which makes two JSON documents easier to compare.

My JSON won’t format. Why?

It is probably invalid — common causes are trailing commas, single quotes and comments. The JSON Validator shows exactly where the problem is and why.

Will large numbers keep their precision?

JavaScript stores numbers as 64-bit floats, so integers larger than 9,007,199,254,740,991 can lose precision when reformatted. If you work with very large IDs, keep them as strings.

Related tools

Minify JSON without changing numbers or strings, strip comments and trailing commas, and see the bytes saved.

FreeRuns in your browser

Validate JSON and pinpoint errors by line and column — including duplicate keys that most parsers ignore.

FreeRuns in your browser

Decode a JSON Web Token, check its claims and expiry, flag risks, and verify HS, RS, PS, ES or EdDSA signatures.

FreeRuns in your browser

Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.

FreeRuns in your browser

Related guides