Tool workspace

JSON Minifier

Input

Minify JSON online by removing unnecessary formatting whitespace. Make JSON text more compact, check its syntax before minifying, and optionally sort object keys. View the size reduction, then copy or download the result.

Input

Output

Loading tool

Loading tool

Developer Tools

JSON Minifier

Minify JSON online by removing unnecessary formatting whitespace. Make JSON text more compact, check its syntax before minifying, and optionally sort object keys. View the size reduction, then copy or download the result.

Quick guide

How to use

Paste or type your JSON into the input editor, or select a .json file from your device. You can also drag and drop a JSON file into the input area.

The tool checks whether the input is valid JSON before minifying it. If the content contains a syntax error, it displays an error message and provides line and column information when the browser makes that position available.

Correct invalid JSON before trying again. The tool does not automatically repair malformed input.

When the JSON is valid, run the minifier to remove unnecessary formatting whitespace. You can also enable automatic minification while typing to update the result as you edit the input.

Details

About this tool

Minify JSON online by removing unnecessary formatting whitespace. Make JSON text more compact, check its syntax before minifying, and optionally sort object keys. View the size reduction, then copy or download the result.

What is JSON minification?

JSON (JavaScript Object Notation) is a text format used to store and exchange structured data. It is commonly used in APIs, web applications, configuration files, and data-processing workflows.

JSON is often formatted with indentation, spaces, and line breaks to make it easier for people to read. These formatting characters can make the text longer than necessary when readability is not the main priority.

JSON minification removes unnecessary formatting whitespace, such as indentation and line breaks. The result is a compact JSON representation that preserves the data values.

For example, minification can be useful when preparing JSON text for an API payload, transferring structured data, or storing a compact version of a JSON document.

JSON minification example

Here is a formatted JSON document:

{

"name": "Alex",

"age": 30,

"active": true,

"skills": [

"HTML",

"CSS",

"JavaScript"

]

}

After minification, it becomes:

{"name":"Alex","age":30,"active":true,"skills":["HTML","CSS","JavaScript"]}

The indentation and line breaks have been removed, but the JSON data remains the same.

Notice that spaces inside string values must be preserved. For example, "Alex Smith" must not become "AlexSmith". Minification removes formatting whitespace, not meaningful characters inside the data.

Optionally sort JSON object keys

You can enable recursive key sorting before minifying. This arranges object keys alphabetically throughout the JSON structure, including nested objects.

For example:

{

"name": "Alex",

"age": 30,

"city": "Berlin"

}

With key sorting enabled, the compact result becomes:

{"age":30,"city":"Berlin","name":"Alex"}

Sorting changes the order of object keys. It does not sort array items. If preserving the original object key order matters to your workflow, leave key sorting disabled.

Check the size reduction

After minification, the tool displays a size summary so you can compare the original input with the output.

It shows:

Input size: The size of the original JSON.

Output size: The size of the minified JSON.

Bytes removed: The difference between the input and output sizes.

Percentage reduction: The proportion of the original size removed.

The actual reduction depends on the formatting of your input. JSON that already has little whitespace may show a smaller reduction than a document with extensive indentation and line breaks.

Minification is not gzip or ZIP compression. It removes unnecessary formatting whitespace from JSON text; it does not apply a separate compression algorithm.

More ways to work with JSON

Practical inputs

Examples JSON

JSON minification example

Here is a formatted JSON document: { "name": "Alex", "age": 30, "active": true, "skills": [ "HTML", "CSS", "JavaScript" ] } After minification, it becomes: {"name":"Alex","age":30,"active":true,"skills":["HTML","CSS","JavaScript"]} The indentation and line breaks have been removed, but the JSON data remains the same. Notice that spaces inside string values must be preserved. For example, "Alex Smith" must not become "AlexSmith". Minification removes formatting whitespace, not meaningful characters inside the data.

Help

Frequently asked questions

What does a JSON minifier do?

A JSON minifier removes unnecessary formatting whitespace, including indentation and line breaks, to create a more compact JSON text while preserving the data.

How do I minify JSON online?

Paste or type JSON into the input editor, upload a .json file, or drag and drop one into the tool. Once the JSON is valid, run the minifier to remove formatting whitespace.

Does minifying JSON change the data?

Minification removes formatting whitespace but preserves meaningful JSON content, including spaces inside string values. If recursive key sorting is enabled, the order of object keys changes.

What does the key-sorting option do?

It sorts object keys recursively, including keys in nested objects. It does not sort array items. Leave it disabled if the original object key order matters.

Can this tool minify invalid JSON?

No. The input must contain valid JSON before it can be minified. The tool reports syntax errors and provides line and column information when available, but it does not repair invalid JSON automatically.

How much smaller will my JSON become?

The reduction depends on how much formatting whitespace the original JSON contains. The tool reports the input size, output size, bytes removed, and percentage reduction after minification.

Is JSON minification the same as gzip compression?

No. Minification removes unnecessary whitespace from JSON text. Gzip uses a separate compression method and is not performed by this tool.

Is my JSON uploaded to a server?

No.