Free online tool

JSON Formatter and Minifier

Format, minify, inspect errors, and safely open JSON files without uploading data.

Format JSON

Beautify or minify valid JSON locally.

You can also drop a .json file here.
Input size
0 B
Output size
0 B
Change
—

How to format JSON

Paste JSON or open a local file, select two or four spaces, and choose Format JSON. Use Minify for compact transport and optionally sort object keys for deterministic fixtures and reviews.

Formatting, errors, and large integers

Syntax errors identify a line and column when the browser provides a position. Formatting and minification preserve integer tokens outside JavaScript’s safe range; key sorting is blocked for those documents to prevent silent rounding.

Frequently asked questions

Does formatting change my data?

No. Formatting changes whitespace and indentation, not JSON values.

Can I minify JSON?

Yes. The Minify action removes unnecessary whitespace.

Are large integers preserved?

Yes when formatting or minifying. Key sorting is disabled for unsafe JavaScript integers to prevent silent rounding.

Can I open a JSON file?

Yes. Select or drop a .json file up to 5 MB; processing remains in the browser.

Prefer Portuguese? Use esta ferramenta em português.

How the tool works

Paste, select, or drop a JSON file, choose two- or four-space indentation, and format or minify it locally. Syntax failures identify the line and column when the browser exposes a character position. Optional recursive key sorting creates deterministic object order.

Supported input and output

The input must follow JSON syntax: property names and strings use double quotes, braces and brackets must balance, and trailing commas or comments are not allowed. Formatting preserves objects, arrays, numbers, booleans, strings, and null values while changing only their whitespace representation.

Practical example

A single-line API response can be expanded so nested fields are easy to scan during debugging. After inspection, the same document can be minified again for a fixture, request body, configuration value, or compact transfer between systems.

Common use cases

A JSON beautifier is useful when reviewing API responses, log payloads, configuration files, webhook events, and test fixtures. Clear indentation helps code review and makes misplaced nesting easier to notice without changing the actual data.

Limits and important checks

Formatting is not schema validation and does not repair ambiguous syntax automatically. Integer tokens outside JavaScript’s safe range are preserved lexically during formatting and minification; key sorting is disabled for those documents because parsing and reserializing could round the value.

Privacy and local processing

Unless the tool explicitly identifies an external lookup, input and generated output are processed in your browser and are not uploaded to CosmoTools. Avoid placing secrets in any web page and review downloaded results before using them in production.