Format, minify and validate JSON in one place
JSON (JavaScript Object Notation) is the most common format for APIs, configuration files and data exports. Minified JSON is efficient for machines but almost impossible for people to read, and a single missing comma breaks everything. This free JSON formatter makes data readable, compact or error-free in one click.
The tool uses your browser’s native JSON parser, so validation follows the official standard (RFC 8259) exactly. Nothing is uploaded, which makes it safe for API responses that contain tokens or customer data.
How to use the JSON formatter
- Paste JSON into the input box, or click Load sample to try it.
- Click Format / Beautify to indent it with 2 spaces, 4 spaces or tabs.
- Click Minify to remove whitespace for production or smaller payloads.
- Click Validate to check the syntax. If something is wrong, you will see the line, the column and the surrounding text.
- Copy the result, download it as a .json file, or replace the input to keep editing.
Features
- Beautify with custom indentation and optional alphabetical key sorting.
- Minify to a single line.
- Precise error location with a snippet of the problem area.
- Colour-coded output for keys, strings, numbers and booleans, in light and dark mode.
- Summary of key count, nesting depth and file size.
Common JSON errors and how to fix them
| Error | Fix |
|---|---|
| Trailing comma after the last item | Remove the comma before } or ]. |
| Single quotes around strings or keys | JSON requires double quotes: "key": "value". |
| Unquoted keys | Wrap every key in double quotes. |
| Comments in the file | Standard JSON does not allow comments. Remove them. |
undefined or NaN | Use null or a number instead. |
Frequently asked questions
Is my JSON data sent to a server?
No. Formatting and validation happen in your browser using the built-in JSON parser.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation for readability. Minifying removes all unnecessary whitespace to make the data as small as possible.
Can it handle large files?
Yes, files of several megabytes work in modern browsers. Syntax highlighting is skipped for very large outputs to keep the page responsive.
Does sorting keys change my data?
No. JSON objects are unordered, so sorting keys only changes the order in which they are shown. Arrays keep their original order.
Related tools
Create secure secrets and test credentials.
Word CounterCount characters in strings and copy.
Meta Description GeneratorWrite SEO snippets for your pages.